Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong description for flag usage #871

Open
yohann-bacha opened this issue Jan 23, 2023 · 1 comment
Open

Wrong description for flag usage #871

yohann-bacha opened this issue Jan 23, 2023 · 1 comment

Comments

@yohann-bacha
Copy link
Contributor

So my idea for the CLI was to specify the optional flags in the usage text.
For example, for the alerts-add command we have the following usage :

NAME:
   scalingo alerts-add - Add an alert to an application

USAGE:
   scalingo alerts-add [command options] [arguments...]
....

As you see, the usage isn't explicit at all.
The command actually have 3 required flags, and 4 optional flags.
Actually, nothing specifies the optional flags expect in the description :

CATEGORY:
   Alerts

DESCRIPTION:
   Add an alert to an application metric.

      The "duration-before-trigger", "remind-every", "below" and "notifiers" flags are optionnal

      Example
...

But this should not be
Technically, following the POSIX Utility Conventions, the usage should contains the flags and arguments that :

  • Are optional are surrounded by brackets [--optional-flag]
  • Are required aren't surrounded by anything

The usage for this command should be :

scalingo alerts-add --container-type value --metric value --limit value [--duration-before-trigger value] 

Or the short version :

scalingo alerts-add -c value -m value -l value [--duration-before-trigger value] [-r value] [-b value] [-n value]

On the paper this is simple. BUT the library we use (urfave/cli) doesn't permit us to customize the usage that much. I struggled a lot reading the source code of the library, thinking about how I could do, to resign that it wasn't possible.
We can provide a CustomUsageTemplate, but in order to correctly fill the usage, we need more information that would need a pull request to urfave/cli to change the library's code.

@guillaume-sc
Copy link

@yohann-bacha,i s the above still valid, after what you changed to the CLI help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants