Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

"--version option cannot be combined with other arguments." is not displayed when "--help" is also specified

オープン
#2,501 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp
領域
cli

調査の方向性

Program.cs の再現から始め、一覧にある --help/--version コマンドの組み合わせを実行して、出力の違いを確認します。次に、CLI が help と version の引数をどのように処理するかを追跡します。両方のオプションを指定したときに、期待されるエラー "--version option cannot be combined with other arguments." が表示されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Hi.

Thank you for System.CommandLine.

The error message "--version option cannot be combined with other arguments." is not displayed when "--help" is also specified on the command line.

Steps to reproduce:

  1. Build console app with Program.cs:
internal class Program
{
    static async Task<int> Main(string[] args)
    {
        RootCommand rootCommand = new RootCommand();

        var option = new Option<bool>("--option1");

        rootCommand.Add(option);

        rootCommand.Handler = CommandHandler.Create(() =>
        {
            Console.WriteLine("Hello, World!");
        });

        return await rootCommand.InvokeAsync(args);
    }
}
  1. Run ConsoleApp1.exe --option1 --version
    Notice the error --version option cannot be combined with other arguments.
    This is expected behavior.

  2. Run ConsoleApp10.exe --help --version
    Notice the error is not displayed.
    Only the version is displayed.
    This is unexpected behavior; I expected the error --version option cannot be combined with other arguments..

  3. Run ConsoleApp10.exe --option1 --help --version
    Notice the error is not displayed.
    Only the version is displayed.
    This is unexpected behavior; I expected the error --version option cannot be combined with other arguments..

System.CommandLine 2.0.0-beta4.22272.1

Thank you.

主要言語
C#
スター
3.7k
フォーク
434
平均マージ
6時間 27分
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotnet/command-line-api のほかの issue

dotnet/command-line-api の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。