Open chshersh opened 1 year ago
I can take a look at this when I get home. I also recently found out using an aliased command keeps the autocomplete working like the original command, so maybe its a good idea to remove the rename flag if that is the source of the issue.
complete -F _tool-sync -o bashdefault -o default tool-sync
Took a quick look at this, it seems the get_name
command takes the name from the Cargo.toml
.
This change
Produces this print out
...
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _alskdjhfasdkjlfh -o bashdefault -o default alskdjhfasdkjlfh
$ lsb_release
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
This is in my .bashrc
eval "$(tool-sync completion bash --rename tool-sync 2> /dev/null)"
This works on both my ubuntu machines. The std err needs to be redirected since it will print the instructions on start up. This is also something that needs to be fixed.
As for the name that gets used when the rename flag is not passed, its currently using the name defined in the Cargo.toml
but it can of course be hard coded by using a constant in the src/lib.rs
instead of calling the get_name
method.
@chshersh are you still experiencing problems?
I'm trying to configure autocompletion for
tool-sync
. Unfortunately, it doesn't work on my Ubuntu 20.04 andbash
shell. I'm trying to add the suggested line to.bashrc
and~/.bash_profile
(I also made sure that I havebash-completion
installed).I tried specifying the following lines. But nothing works for me:
So some investigation is required to fix this. Maybe it's just me. I'll have a look at the completion package and see if anything needs to be done or how to make it work.
On top of that, I can see, this probably happens because by default, the
tool completion
command uses thetool-sync
name.It would be great if
tool
was used by default (maybe there's a way to do this in the autocompletion package we use?). Otherwise, documentation should change to always suggest the--rename
flag.