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

Some bugs when completing -h and -V #27

Open
huyz-git opened this issue Jan 4, 2020 · 3 comments
Open

Some bugs when completing -h and -V #27

huyz-git opened this issue Jan 4, 2020 · 3 comments

Comments

@huyz-git
Copy link

huyz-git commented Jan 4, 2020

When type conda - and press tab, my terminal shows these:

$ conda -
--help                                                                                                 
--version                                                                                              
-h                                                                                                     
-V                                                                                                     
-- show this help message and exit                                                                     
-- show programs version number and exit                                                               
--help                                                                                                 
--version                                                                                              
-h                                                                                                     
-V                                                                                                     
-- show this help message and exit                                                                     
-- show programs version number and exit                                                               
--help                                                                                                 
--version                                                                                              
-h                                                                                                     
-V                                                                                                     
-- show this help message and exit                                                                     
-- show programs version number and exit

I uses oh-my-zsh to manage this plugin.

@esc
Copy link
Contributor

esc commented Jan 6, 2020

@huyizheng thanks for reporting this and thanks for using this completion. I am not sure how you ended up in this situation and I don't see an easy way to debug this. I will however leave this issue open however in case anyone else experiences this too or maybe even has a fix.

@huyz-git
Copy link
Author

huyz-git commented Jan 16, 2020

@huyizheng thanks for reporting this and thanks for using this completion. I am not sure how you ended up in this situation and I don't see an easy way to debug this. I will however leave this issue open however in case anyone else experiences this too or maybe even has a fix.

I fixed this bug, it seems cause by the line : :->command. (But I don't know why)
I just changed it into this, directly passes the function into the arguments:

_arguments -C $opts \
           ': :__conda_commands' \
           '*:: :->subcmd'

then this bugs is fixed.

Also, in the completion of conda env there's a similar bug, to fix it I create another function like this:

_env_command() {
    local -a env
    env=(
        create:'Create an environment based on an environment file'
        export:'Export a given environment'
        list:'List the Conda environments'
        remove:'Remove an environment'
        update:'Update the current environment based on environment file'
        )
    _describe -t env_commands "help commands"  env
}

And then directly passes it into the arguments:

    (env)
        _arguments -C $help_opts \
                      ': :_env_command' \
                      '*:: :->subcmd'

diff.txt

@esc
Copy link
Contributor

esc commented Jan 20, 2022

@huyz-git thank you for looking into this. Could you submit this as a pull-request, it will make testing and integration much easier, thank you!

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

2 participants