Dvc: scripts: update bash autocomplete script

Created on 30 May 2019  Â·  19Comments  Â·  Source: iterative/dvc

As detected in https://github.com/iterative/dvc/pull/2064#pullrequestreview-243033761 (wait for that PR to merge)

Script located in https://github.com/iterative/dvc/blob/master/scripts/completion/dvc.bash

  • [x] So commands and their options are current (previous update: #1732)
  • [x] It would be nice that it completes file names appropriate to the context as indicated in the docs (per this discord message).
good first issue help wanted

Most helpful comment

The previous script only showed files not the commands. I have updated and added commands as well as files.

All 19 comments

@shcheklein Can you please explain me what has to be done here? I guess one of the tasks is completed.

@Naba7 , the autocompletion script is outdated https://github.com/iterative/dvc/blob/master/scripts/completion/dvc.bash

It means that it's missing some commands and options, one half of the task is to make sure that all the commands are supported with their respective flags.

And the other one is to add support for completing file names, for example: $(compgen -G '*.dvc').

Alright, Thanks. I am checking onto that.

  • [ ] Yet another desirable improvement is to include command and option descriptions to the autocomplete like in the zsh script but I'm not sure bash supports that. Thanks

@jorgeorpinel , I think Bash doesn't support such thing :sweat:

Hi. PR #2205 may close this. Can someone who uses bash check? @Naba7 perhaps. (You'd have to pull from my fork and run DVC on dev mode from there.)

@jorgeorpinel how can #2205 close this? I'm not sure I'm following this :)

with the changes to scripts/completion/dvc.bash. See https://github.com/iterative/dvc/pull/2205/files#diff-52c40123385500205889d77541831837

This was closed accidentally with e04e4c0 BTW. Please re-open @shcheklein or @efiop (I can't.). Not sure that's all the updates needed to the bash autocomplete script.

@jorgeorpinel Reopened.

Aand closed with #2195 :slightly_smiling_face:

Ok, but the subcommands for bash are not supported yet. This might be the solution https://stackoverflow.com/questions/17879322/how-do-i-autocomplete-nested-multi-level-subcommands . Will keep this open for now.

Does the lack of subcommands blocks the #2181 ? Commands and file names completion already seems as a great improvement and having it out of the box after installation would be nice.

@nik123 It doesn't :slightly_smiling_face: As I've mentioned in https://github.com/iterative/dvc/issues/2181#issuecomment-505134891 , we can totally include what we have already into our packages, and update our bash scripts later.

Reopened... Aand closed with #2195 🙂

Haha thanks.

https://stackoverflow.com/a/17881946/761963

Def. worth trying 😃

Yes, I will check into this @efiop @jorgeorpinel

The previous script only showed files not the commands. I have updated and added commands as well as files.

@Naba7 does it really work with files? I have just downloaded the latest version from here and put it in /etc/bash_completion.d it doesn't complete file names.

For example I have train.dvc file in my repo. I type dvc status tr and press tab key. I expect that command will be completed with train.dvc but nothing happens.

I am still working on it.

On Sun 7 Jul, 2019, 11:42 AM nik123, notifications@github.com wrote:

@Naba7 https://github.com/Naba7 does it really work with files? I have
just downloaded the latest version from here
https://github.com/iterative/dvc/blob/01e2fe379caeff52e1f00f6d2143dbec18069f47/scripts/completion/dvc.bash
and put it in /etc/bash_completion.d it doesn't complete file names.

For example I have train.dvc file in my repo. I type dvc status tr and
press tab key. I expect that command will be completed with train.dvc but
nothing happens.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/iterative/dvc/issues/2069?email_source=notifications&email_token=AHQZX5ZMHZGEKJAG2NGXS73P6GCLBA5CNFSM4HQWRAX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZLFKAQ#issuecomment-508974338,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHQZX5Z5IFRJGLAWFBEOPV3P6GCLBANCNFSM4HQWRAXQ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tc-ying picture tc-ying  Â·  3Comments

robguinness picture robguinness  Â·  3Comments

shcheklein picture shcheklein  Â·  3Comments

TezRomacH picture TezRomacH  Â·  3Comments

shcheklein picture shcheklein  Â·  3Comments