commandlineparser / commandlineparser/commandline

Showing help with no arguments when you have a default verb

Open
#748 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.8k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

I want to show the verbs help when you provide no arguments:

`tool` --> Shows verbs help.
`tool arg1 arg2` --> Executes default verb with those args.

By default, it either executes the default verb without arguments or, if this verb has required values, it shows the error and help for that verb.

My current workaround is this one, but I wonder if there is a neater way:

```csharp
if (args.Length == 0)
{
args = new[] { "--help" };
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the parser handles zero arguments and selects a default verb, then reproduce the two command examples from the issue. Done means no arguments show the verbs help, while additional arguments still execute the default verb with those arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.