dotnet / dotnet/command-line-api

Generating CLI tool usages

Open
#831 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

Is there a way to get the usages generated to reflect that a program is intended to used as a CLI tool? What I would like to see is the `--help` switch return the following, similar to how `dotnet test` does.

I have tried setting the `RootCommand.Name` property to "dotnet mytool" but that threw an `ArgumentException` about whitespace. I have also looked at using a custom `IHelpBuilder`, but overriding `AddUsage` to add this is looking like a _lot_ of work.

Currently `--help` produces this:
```
C:\Users\Paul>dotnet mytool --help
mytool:
My Tool

Usage:
mytool [options]

Options:
--dry-run Executes the command without making any changes.
-?, -h, --help Show help and usage information
```

What I would like to see is:
```
C:\Users\Paul>dotnet mytool --help
mytool:
My Tool

Usage:
dotnet mytool [options]

Options:
--dry-run Executes the command without making any changes.
-?, -h, --help Show help and usage information
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.