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

Support for aliases when importing command to CLI using add_command #8

Closed
tjzegmott opened this issue May 3, 2023 · 6 comments
Closed

Comments

@tjzegmott
Copy link

Do you plan on adding support for the following situation?

# cli.py
import click

from click_aliases import ClickAliasedGroup

from foo import foo


@click.group(cls=ClickAliasedGroup)
def cli():
    pass


cli.add_command(foo, aliases=['bar', 'baz', 'qux'])

if __name__ == "__main__":
    cli()

# foo.py
import click


@click.command()
def foo():
    """Run a command."""
    click.echo('foo')
@themagiulio
Copy link
Contributor

@tjzegmott I added a PR #9. Hopefully the maintainer will merge it.

@rbonthond
Copy link
Collaborator

I've merged it

@cproctor
Copy link

When you get a chance, could you please release a new version on PyPI with this feature?

@themagiulio
Copy link
Contributor

When you get a chance, could you please release a new version on PyPI with this feature?

It would be nice to have this feature upstream. However, if you need this asap I suggest you to create the module with the new changes in your own project. As an example I leave here the module I've added to a cli I've created in the past months: https://github.com/themagiulio/memos-cli/blob/master/memos/click_aliases.py

Note: creating the module by yourself will prevent changes made upstream by the click-aliases creator. So I would consider this as a temporary fix.

@abrahammurciano
Copy link

I too would like this feature to be pushed to pypi. I pretty much exclusively use add_command and I'd love to use this library in my projects. Thanks ❤️

@rbonthond
Copy link
Collaborator

I've published an 1.0.2 release. It's been years since I've done a release, so please check and let me know how it goes.

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

5 participants