Closed AlJohri closed 7 years ago
This is a configuration of your shell, where you need to make it consider envdir ...
to be handled like with sudo
etc.
See https://github.com/blueyed/oh-my-zsh/commit/59d43ad766c8625fcd7e6373e80a8ab39288ac36 for my completion script that I am using for Zsh.
Closing this issue, since it's not an issue of envdir
- but we could consider shipping some completion scripts by default, and/or I could add mine to https://github.com/zsh-users/zsh-completions.
Hi @blueyed,
I'm having some issues using the envdir zsh completion script.
It first tries to autocomplete an " -- external command --" which seems correct but after that it only autocompletes a "-- file --" not taking into account the external command. This does not work for commands such as rake
, make
, rails
, django-admin
, etc.
I've created a test case that demonstrates the issue in detail.
Contains a Makefile, Rakefile, and two environments (env
and prod
) with a single environment variable SOMEVAR
.
➜ test_envdir_autocomplete tree
.
├── Makefile
├── Rakefile
└── envs
├── dev
│ └── SOMEVAR
└── prod
└── SOMEVAR
3 directories, 4 files
➜ test_envdir_autocomplete cat Rakefile
desc "hello"
task :hello do
puts "hello from rake! SOMEVAR is #{ENV['SOMEVAR']}"
end
desc "goodbye"
task :goodbye do
puts "goodbye from rake! SOMEVAR is #{ENV['SOMEVAR']}"
end
➜ test_envdir_autocomplete cat Makefile
.PHONY: hello goodbye
hello:
@echo "hello frome make. SOMEVAR is $(SOMEVAR)"
goodbye:
@echo "goodbye frome make. SOMEVAR is $(SOMEVAR)"
SOMEVAR
is true
in dev
and false
in prod
.
➜ test_envdir_autocomplete tail envs/**/*(.)
==> envs/dev/SOMEVAR <==
true
==> envs/prod/SOMEVAR <==
false
As you can see from the screenshots below, the envdir completion script is picking up -- file --
as opposed to -- make targets --
or -- rake target --
.
Typing make
, space, and <TAB>
.
Typing rake
, space, and <TAB>
.
Typing envdir envs/dev
, space, and <TAB>
.
Typing envdir envs/dev make
, space, and <TAB>
.
Typing envdir envs/dev rake
, space, and <TAB>
.
➜ test_envdir_autocomplete zsh --version
zsh 5.2 (x86_64-apple-darwin15.0.0)
➜ test_envdir_autocomplete brew list --versions | grep zsh
zsh 5.2
zsh-syntax-highlighting 0.4.1
Using zprezto which has zsh-completions as a git submodule.
Thanks for the detailed report.. I was aware of this issue (but forgot about it).
It can be reproduced by envdir envdir ls -<tab>
.
The fix is to use _precommand
instead of _normal
.
Updated: https://github.com/blueyed/oh-my-zsh/blob/master/functions/_envdir.
thanks @blueyed! just tested and confirmed this works. I'd love to get this merged into zsh-completions
@AlJohri There you go: https://github.com/zsh-users/zsh-completions/pull/459
I've been running rake tasks with envdir like so:
For some reason, rake stops autocompleting when used with envdir.
Do you think this has to do with envdir or the way the autocomplete script is written?