pcapriotti / pcapriotti/optparse-applicative

Default command and command alias

Open
#484 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
959
Forks
123
Avg merge
3d 19h
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the command-parsing and help-generation behavior described in the issue, including how Alternative is currently used. Define how command aliases and a default command should affect parsing and help output; done means both behaviors work without duplicating commands or exposing irrelevant options.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.