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

[fish] Flags are not completed after first flag has been completed #1212

Closed
zx8 opened this issue Mar 18, 2018 · 3 comments
Closed

[fish] Flags are not completed after first flag has been completed #1212

zx8 opened this issue Mar 18, 2018 · 3 comments

Comments

@zx8
Copy link

zx8 commented Mar 18, 2018

Rust Version

  • rustc 1.24.1 (d3ae9a9e0 2018-02-27)

Affected Version of clap

  • v2.31.1

Expected Behavior Summary

$ rg --<TAB>
# list of completions
$ rg --no-follow --<TAB>
# list of completions

Actual Behavior Summary

$ rg --<TAB>
# works - list of completions
$ rg --no-follow --<TAB>
# broken; no completions
@zx8
Copy link
Author

zx8 commented Mar 18, 2018

The issue here is the usage of the __fish_using_command function. Here's what's going on:

$ rg --no-follow --<TAB>
function __fish_using_command
    # cmd is set to array: ["rg", "--no-line-number"]
    set cmd (commandline -opc)
    # 'count $cmd' is 2, 'count $argv' is 1  
    if [ (count $cmd) -eq (count $argv) ]
        # etc.
        return 0
    end
    # no completions
    return 1
end

If you drop this function entirely (which I understand was introduced to fix subcommand completion; #687, /ping @wdv4758h), flag completions >1 work again, i.e.

complete -c rg -s N -l no-line-number -d 'Suppress line numbers.'

@wdv4758h
Copy link
Contributor

this issue fix so fast, nice 👍

@kbknapp
Copy link
Member

kbknapp commented Mar 19, 2018

I'm putting out the new version in just a minute :)

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

3 participants