Git Product home page Git Product logo

Comments (3)

flokno avatar flokno commented on June 26, 2024

I feel the -f is there to supress file suggestions when one is still fishing for options (with -f removed one sees file suggestions always). Thus I think it should be triggered from the app and not being hard coded to the command.

from click-completion.

flokno avatar flokno commented on June 26, 2024

I use this fork for now: https://github.com/flokno/click-completion/tree/fish_complete_files

Any comments/suggestions on how to approach this?

from click-completion.

exploide avatar exploide commented on June 26, 2024

While using pipenv, which makes use of click-completion, I encountered this problem, too. E.g. pipenv install -r should complete files, but doesn't, which is annoying. A related issue was reported there pypa/pipenv#3478

I took a look at the code of click-completion. The -f option mentioned in the first comment is obviously the cause for this. But just removing the -f would imply that unnecessary file arguments get completed when, for example, just subcommands make sense.

So either the stub fish completion template needs to become more complex (don't know yet how to do that in an universal way) or click-completion needs to emit file completions by itself (and stay with the global -f).

It looks like this is done for the zsh completion automatically when there are no other explicit arguments to complete. However, the way this is done seems not to work with fish. So maybe this needs indeed to be done with an additional function. The completions for pip (without click-completion) do something like that: https://github.com/pypa/pip/blob/69a811cec64d16f4a3c84f685c50ac319f938772/src/pip/_internal/cli/autocompletion.py#L136

Instead of doing this when there are no other explicit arguments, it could be reasonable to check if the to be completed option is a click file argument https://click.palletsprojects.com/en/master/arguments/#file-arguments (though, I have no experience with click).

Would be great if this can eventually be resolved somehow.

from click-completion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.