commandlineparser / commandlineparser/commandline

--help not quitting program.

オープン
#845 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る
主要言語
C#
スター
4.8k
フォーク
478
PR マージ指標
30日以内にマージされた PR はありません

説明

calling my console app with single parameter --help or --version is showing the help/version, but then not quitting the app. It continues to run. My setup code is as follows:

```
var result = Parser.Default.ParseArguments(args)
.WithParsed(o =>
{
if (o.Dest != null && o.Dest.Trim() != "")
{
rootOutputFolder = o.Dest.Trim();
}
else
{
// default to current folder's converted_databases/ subfolder
string? currentFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
if (currentFolder == null)
{
throw new Exception("Could not get current folder");
}
rootOutputFolder = Path.Combine(currentFolder, "converted_databases");
if (!Directory.Exists(rootOutputFolder))
{
DirectoryInfo di = Directory.CreateDirectory(rootOutputFolder);
}
}

if (o.Verbose)
{
db.DoLog = true;
Logger.DoOleLog = true;
}
});

public class Options
{
[Option('d', "dest", Required = false, HelpText = "Full path to root output folder for converted databases. If not specified, will default to .\\converted_databases\\")]
public string? Dest { get; set; }

[Option('v', "verbose", Required = false, HelpText = "Log all SQL queries in converter.log.")]
public bool Verbose { get; set; }
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

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

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