alecthomas / alecthomas/kong

Print usage on input without commands/args/flags

Offen
#33 17 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
3.2k
Forks
188
Ø Merge
1 T. 1 Std.
Gemergte PRs (30 T.)
2

Beschreibung

In the scenario of app invocation from terminal without _any_ command/flags
```bash
> my-app
```
I'd expect the same output of:

```bash
> my-app --help
```

Instead, I have the error about the missing command.
```bash
my-app: error: expected one of "cmd1", "cmd2"
```
Is there a way/configuration to achieve my expected outcome?

The closest function I've found is ```kong.UsageOnError()```, except it prints usage help for any error (when for any other type of error I'd expect to just print the specific error).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.