huggingface_hub icon indicating copy to clipboard operation
huggingface_hub copied to clipboard

Shell completions

Open Freed-Wu opened this issue 3 years ago • 7 comments

Is your feature request related to a problem? Please describe. Add shell completions for huggingface-cli

Describe the solution you'd like https://docs.iterative.ai/shtab Describe alternatives you've considered https://docs.iterative.ai/shtab/#alternatives

Freed-Wu avatar Nov 18 '22 08:11 Freed-Wu

Hi @Freed-Wu, thanks for the idea. Seems a good suggestion to facilitate user experience. However I don't have experience in it. Would you mind implementing a POC to show how this would integrate with huggingface-cli and make a PR for it ?

Something we should keep it mind is that installing shtab (or argcomplete) should be optional for our users. So I would add the dependency to the "cli" group in setup.py.

Side question: is this something that would integrate well with Windows cmd ?

Wauplin avatar Nov 18 '22 09:11 Wauplin

should be optional for our users

is this something that would integrate well with Windows cmd

  • cmd don't support customization of completion.
  • Now shtab only support bash/zsh/tcsh, and will support fish/powershell in roadmap.

Freed-Wu avatar Nov 18 '22 10:11 Freed-Wu

I would add the dependency to the "cli" group in setup.py.

Why not completion to keep same as these examples?

Freed-Wu avatar Nov 18 '22 10:11 Freed-Wu

Why not completion to keep same as these examples?

Fine with completion ! :)

And thanks for clarification on supported shells.

Wauplin avatar Nov 18 '22 10:11 Wauplin

Fine with completion ! :)

OK. I've give a PR with 'completion'

And thanks for clarification on supported shells.

You're welcome.

Freed-Wu avatar Nov 20 '22 10:11 Freed-Wu

Using Click might be helpful here: https://click.palletsprojects.com/en/8.1.x/shell-completion/

remyleone avatar Nov 09 '23 10:11 remyleone

Using Click might be helpful here: https://click.palletsprojects.com/en/8.1.x/shell-completion/

As a matter of fact, yes we are (re-)considering the idea of using click (or Typer). However this would mean adding a (quite big) dependency to the project which we'd like to avoid -since CLI is only an "option" for huggingface_hub, not everyone uses it-. There are also suggestions from @Freed-Wu about how to implement shell completion with the current setup (see https://github.com/huggingface/huggingface_hub/pull/1207#issuecomment-1779536093). We are trying to see which direction we want to take and (hopefully) will get back here once decided. For the context, the CLI has not been our focus until now but this is changing, especially since we release huggingface-cli upload and huggingface-cli download support.

Wauplin avatar Nov 13 '23 17:11 Wauplin