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

Default command and command alias #484

Open
bingis-khan opened this issue Jul 28, 2023 · 0 comments
Open

Default command and command alias #484

bingis-khan opened this issue Jul 28, 2023 · 0 comments

Comments

@bingis-khan
Copy link

Is it possible to create an alias of a command? For example in the help menu, under "Available commands", there would be something like this:

Available commands:
  search, s                         Do some searching or whatever.
  ...

Also might be related: is it possible to specify a defaut command?


Note that all of the things above are possible with a liberal use of Alternative, but these make the help menu much less appealing:

                                    \/-- looks meh
Usage: surcher [(-p|--port PORT) | COMMAND] [-d|--dir PATH]

Available options:
  -p,--port PORT           Port on which to serve the web interface.  <- this should probably be only visible in the help menu for "serve"
  -h,--help                Show this help text

Available commands:
  search                   Execute a single search with a query.
  s                        Serve a website for searching. <- """""alias"""""
  serve                    Serve a website for searching.
georgefst added a commit to georgefst/monpad that referenced this issue Sep 22, 2023
Inspired by pcapriotti/optparse-applicative#484. This is actually pretty neat, even if the help text is slightly odd. This is probably the best interface we can have without some form of "default command" as discussed there, or option groups (pcapriotti/optparse-applicative#270).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant