Handling shell completions
Describe the bug
This might be more of an enhancement than a bug.
It would be lovely if devenv shell would configure the appropriate shell completions automatically. Alternatively, documenting the recommended way of configuring shell completions would be lovely.
To Reproduce
mkdir devenv-bug-shell-completion
cd devenv-bug-shell-completion
devenv init
devenv shell
git init
git b<tab>
I'd love for tab completions to just work™️
Version
0.4 running on an M1 Mac.
(devenv) bash-5.1$ devenv version
devenv: 0.4
#191 fixes this
Could you try main branch?
@domenkozar What's the easiest way to test main? I just followed the install instructions to get v0.4 originally
nix profile install github:cachix/devenv/main
I had originally installed it using nix-env so had to switch to using nix profile it seems.
I think I'm running the latest version now. See this little session below. I was originally confused why it would self-report as version 0.4 but seems that might just be hard-coded ☺️
Madss-MBP% nix profile list
0 - - /nix/store/7bdqzf2a81h2g83wb02s5nx4xfn2hn0b-cachix-1.0.1
Madss-MBP% which devenv
devenv not found
Madss-MBP% nix profile install github:cachix/devenv/main
warning: Using saved setting for 'extra-substituters = https://devenv.cachix.org' from ~/.local/share/nix/trusted-settings.json.
warning: Using saved setting for 'extra-trusted-public-keys = devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=' from ~/.local/share/nix/trusted-settings.json.
Madss-MBP% which devenv
/Users/mads/.nix-profile/bin/devenv
Madss-MBP% nix profile list
0 - - /nix/store/7bdqzf2a81h2g83wb02s5nx4xfn2hn0b-cachix-1.0.1
1 github:cachix/devenv/main#defaultPackage.aarch64-darwin github:cachix/devenv/b7f2889c4fa3c737ea2df3c49291dd41be77c14f#defaultPackage.aarch64-darwin /nix/store/zafk423nlwyjmdh4qky7wm8wmrik7djl-devenv
Madss-MBP% devenv version
devenv: 0.4
With this version I still don't get tab completion for git when running the instructions in the issue description above I'm afraid ☺️
we probably need to do something like https://github.com/NixOS/nixpkgs/blob/45b92369d6fafcf9e462789e98fbc735f23b5f64/nixos/modules/programs/bash/bash-completion.nix#L24
@domenkozar If you're not in a rush getting this closed I'd be happy to give it a go. As this would be my first proper Nix project I contribute to I expect progress to be slow. Right now I don't even know what the dev-loop looks like for working on devenv ☺️
As a hacky solution I use following oneliner in enterShell option, obviously this is for bash shell
enterShell = "
. <(cat $DEVENV_PROFILE/share/bash-completion/completions/*)
";
There's shell completion for devenv since many versions ago.