Skip to content

Allow the creation of command aliases #60

@richieadler

Description

@richieadler

In many cases, several names are needed to invoke the same command.

It would be nice to have a way to specify an alias for a command, and have the alias mentioned in the help, without the need to define repeated entries in a command dictionary, and without the redefined function appearing several times in the help message.

For instance, doing this:

# 1.py
import clize

def foo():
    "Function foo"
    pass

def bar():
    "Function bar"
    pass


if __name__ == '__main__':
    clize.run(dict(foo=foo, bar=bar, foo2=foo))

produces

Usage: 1.py command [args...]

Commands:
  foo    Function foo
  bar    Function bar
  foo2   Function foo

The desired outcome (by whatever method is implemented) would be more like

Usage: 1.py command [args...]

Commands:
  foo    Function foo (alias: foo2)
  bar    Function bar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions