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

Add option to avoid that '[arguments...]' been printed #1069

Open
3 tasks done
tredoe opened this issue Feb 12, 2020 · 12 comments
Open
3 tasks done

Add option to avoid that '[arguments...]' been printed #1069

tredoe opened this issue Feb 12, 2020 · 12 comments
Labels
area/v3 relates to / is being considered for v3 help wanted please help if you can! kind/feature describes a code enhancement / feature request status/confirmed confirmed to be valid, but work has yet to start
Milestone

Comments

@tredoe
Copy link

tredoe commented Feb 12, 2020

Checklist

  • Are you running the latest v2 release?
  • Did you check the manual for your release?
  • Did you perform a search about this feature?

What problem does this solve?

  • By default, the help of a command shows the section USAGE with a text like:
    cmd_name [global options] command [command options] [arguments...]
    showing [arguments...] even when your command is not going to use any argument.

Solution description

Add a boolean to indicate that [arguments...] does not been printed.

@tredoe tredoe added area/v2 relates to / is being considered for v2 status/triage maintainers still need to look into this labels Feb 12, 2020
@coilysiren
Copy link
Member

This makes sense to me @tredoe! Although I want to check to see if anyone else in @urfave/cli also thinks this is a good idea? Since I know we've had some concerns about there being too many options.

@AudriusButkevicius
Copy link
Contributor

I think we should just not print that if the app does not support arguments, makes no sense to hide it behind a flag.

@coilysiren
Copy link
Member

not print that if the app does not support arguments

is there a way to indicate that an app does not support arguments?

@rliebz
Copy link
Member

rliebz commented Feb 13, 2020

is there a way to indicate that an app does not support arguments?

Looks like there isn't—we expose the args as a string slice directly off of the flag set. We don't have a way to tell if a user application happens to call that function or not.

Although I want to check to see if anyone else in @urfave/cli also thinks this is a good idea? Since I know we've had some concerns about there being too many options.

I do see this as a common use case, but if we added a configurable field for every common use case, we'd end up with a pretty big list of fields. It's trivial to pass a custom help template in for an App, so I'm in favor of not expanding our interface and letting users set the CustomAppHelpTemplate themselves:

app.CustomAppHelpTemplate = myCustomTemplate

Where myCustomTemplate can be the exact same as cli.AppHelpTemplate, minus the arguments.

@tredoe
Copy link
Author

tredoe commented Feb 13, 2020

Although I want to check to see if anyone else in @urfave/cli also thinks this is a good idea? Since I know we've had some concerns about there being too many options.

I do see this as a common use case, but if we added a configurable field for every common use case, we'd end up with a pretty big list of fields. It's trivial to pass a custom help template in for an App, so I'm in favor of not expanding our interface and letting users set the CustomAppHelpTemplate themselves:

app.CustomAppHelpTemplate = myCustomTemplate

Where myCustomTemplate can be the exact same as cli.AppHelpTemplate, minus the arguments.

I don't see a problem by having a great list of fields; the standard library has several types with a pretty big list of fields i.e. at the package http.

@rliebz
Copy link
Member

rliebz commented Feb 13, 2020

HTTP solves a complex problem, as does a CLI library, so the number of knobs we end up with is definitely a product of that complexity. But part of managing software is trying to reduce the amount of complexity we have to deal with. For the http package, how many of those configuration fields have trivial alternatives?

A few of the problems with having too many fields:

  • More code for library authors to maintain/test
  • Commitment to backward compatibility—we can't easily undo adding an option to a library
  • Harder for users to find which configuration fields are relevant for them, versus which ones support niche use cases
  • More interactions between options that could be the source of bugs or other unexpected behaviors
  • Adding options now limits future design space in a few ways—every new feature has to be compatible with every existing feature, or the usability starts to suffer

@tredoe
Copy link
Author

tredoe commented Feb 13, 2020

HTTP solves a complex problem, as does a CLI library, so the number of knobs we end up with is definitely a product of that complexity. But part of managing software is trying to reduce the amount of complexity we have to deal with. For the http package, how many of those configuration fields have trivial alternatives?

The type Request from package HTTP was only an example; I have read the standard library so I know that it has many types with a big list of fields; more examples: type header at tar, or type FileHeader at zip.

@tredoe
Copy link
Author

tredoe commented Feb 13, 2020

A few of the problems with having too many fields:

* More code for library authors to maintain/test
* Commitment to backward compatibility—we can't easily undo adding an option to a library
* More interactions between options that could be the source of bugs or other unexpected behaviors

Your points are valid for whatever code that been added; I mean that it is not exclusive to have "many fields" into a structure.

* Harder for users to find which configuration fields are relevant for them, versus which ones support niche use cases

It is solved with the documentation.

* Adding options now limits future design space in a few ways—every new feature has to be compatible with every existing feature, or the usability starts to suffer

This was solved a long time ago with versioning software.

@coilysiren
Copy link
Member

See also => #1074

@coilysiren
Copy link
Member

I'm making this as help wanted primarily because the desired solution almost certainly includes the work required for this issue => #1074

@coilysiren coilysiren added help wanted please help if you can! status/confirmed confirmed to be valid, but work has yet to start and removed status/triage maintainers still need to look into this labels Mar 30, 2020
@stale
Copy link

stale bot commented Jun 29, 2020

This issue or PR has been automatically marked as stale because it has not had recent activity. Please add a comment bumping this if you're still interested in it's resolution! Thanks for your help, please let us know if you need anything else.

@stale stale bot added the status/stale stale due to the age of it's last update label Jun 29, 2020
@stale
Copy link

stale bot commented Jul 29, 2020

Closing this as it has become stale.

@stale stale bot closed this as completed Jul 29, 2020
@meatballhat meatballhat reopened this Apr 22, 2022
@meatballhat meatballhat removed the status/stale stale due to the age of it's last update label Apr 22, 2022
@meatballhat meatballhat changed the title v2 feature: Add option to avoid that '[arguments...]' been printed Add option to avoid that '[arguments...]' been printed Apr 22, 2022
@meatballhat meatballhat added the kind/feature describes a code enhancement / feature request label Apr 22, 2022
@dearchap dearchap removed the area/v2 relates to / is being considered for v2 label Nov 3, 2022
@dearchap dearchap added the area/v3 relates to / is being considered for v3 label Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v3 relates to / is being considered for v3 help wanted please help if you can! kind/feature describes a code enhancement / feature request status/confirmed confirmed to be valid, but work has yet to start
Projects
None yet
Development

No branches or pull requests

6 participants