Was the title of this supposed to say 'zsh' instead of 'bash'?
Yes :)
Love the idea, but this isn't a priority at this time.
Reopening, because there are zsh users out there and they might like it. Shouldn't be that hard, depending on the level of support in cobra now.
Maybe you can use in the meantime https://github.com/zsh-users/zsh-autosuggestions for autocomplete suggestions based on your history?
I use it with oh-my-zsh as plugin.
Download it with git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions and add zsh-autosuggestions in the plugins section of your .zshrc file.
Nice, thanks @KaffDaddy
ZSH will be the new standard in OSX Catalina. Would be nice if this gets implemented sooner or later ;-)
@KaffDaddy Thanks for this tip :-)
It shouldn't be too hard to add the limited support cobra offers, and I'm sure the macOS change will pressure cobra and us to get this in. It really isn't very hard from this end. Thanks for chiming in!
I'd like to bump this issue. Would be really cool to have zsh autocompletion! At best including the custom commands as well.
Thanks for bumping!
Ran into this today myself after a Catalina update.
Hi @rfay, just wondering if there has been any more updates on the auto-complete plugin? Would by really great if this is available! :-)
Thanks for checking in @karlosb ! It helps us know who wants what! It looks like the reports on https://github.com/spf13/cobra/issues/107 are quite bad, and there doesn't seem to be much going on there.
https://github.com/spf13/cobra/pull/646 did get pulled.
There were some issues in https://github.com/spf13/cobra/issues/881 that look like they may be somewhat of a stumbling block, but it sounds like within limits the pulled PR is doing OK.
So this will be worth looking at :) Thanks!
Hi @rfay many thanks for the update on this. Are you saying there is an updated version of DDEV that we can try this out?
No @karlosb it will take some work to integrate the work mentioned above, if it works out we can hope it will be in a future release.
No @karlosb it will take some work to integrate the work mentioned above, if it works out we can hope it will be in a future release.
That's great news for all the zsh Users out there :-) Very much appreciate this!
For those of you who use zsh, I'd love to have you try out the zsh autocomplete artifacts at https://github.com/drud/ddev/pull/2234#issuecomment-623575961 - I think you'll like them.
Hi Randy,
How do we get this up and running?
I have updated ddev to v1.14.1 via Homebrew.
I can see some .zip file links in the thread at https://github.com/drud/ddev/pull/2234#issuecomment-623575961 but not sure how to get them installed?
Regards
Karl
On 5 May 2020, at 15:52, Randy Fay notifications@github.com wrote:
For those of you who use zsh, I'd love to have you try out the zsh autocomplete artifacts at #2234 (comment) https://github.com/drud/ddev/pull/2234#issuecomment-623575961 - I think you'll like them.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/drud/ddev/issues/327#issuecomment-624102868, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWPHLGWT6UAPU7NAWMBUOTRQAR3DANCNFSM4DPMVBIQ.
@karlosb thanks for testing. As that comment says,
To test, please unzip it into your local $fpath, then rm -f ~/.zcompdump && compinit. You should then have zsh autocompletion working
Hi Randy,
Can you advise where the $fpath is located?
On 5 May 2020, at 17:34, Randy Fay notifications@github.com wrote:
@karlosb https://github.com/karlosb thanks for testing. As that comment https://github.com/drud/ddev/pull/2234#issuecomment-623575961 says,
To test, please unzip it into your local $fpath, then rm -f ~/.zcompdump && compinit. You should then have zsh autocompletion working
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/drud/ddev/issues/327#issuecomment-624162014, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWPHLFTFQEMX54VBL7EP6DRQA5ZDANCNFSM4DPMVBIQ.
It's an environment variable that zsh uses to figure out where it loads functions from. So echo $fpath. You'll likely want to create a new directory for now, like mkdir ~/.zshfuncs and then change your .zshrc to export fpath=(~/.zshfuncs $fpath)
This Stack Overflow may help you.
I'm a n00b to zsh, so just learning as I go along.
Hi Randy,
A bit lost to be honest!
I’ve followed all the instructions above, but not working.
I use ‘oh my zsh’ for configuring/customising zsh (see: https://github.com/ohmyzsh/ohmyzsh).
And Oh my zsh has a plugin library here: https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
I’m just wondering if the ddev plugin can be formatted like one of those plugins?
On 5 May 2020, at 17:51, Randy Fay notifications@github.com wrote:
It's an environment variable that zsh uses to figure out where it loads functions from. So echo $fpath. You'll likely want to create a new directory for now, like mkdir ~/.zshfuncs and then change your .zshrc to export fpath=(~/.zshfuncs $fpath)
This Stack Overflow https://unix.stackexchange.com/a/26558/53208 may help you.
I'm a n00b to zsh, so just learning as I go along.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/drud/ddev/issues/327#issuecomment-624172268, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWPHLEWRFZBSSSGCFJPV7LRQA7XNANCNFSM4DPMVBIQ.
We should probably let the experts weigh in here. I haven't experimented with ohmyzsh and completions yet. I'll try ohmyzsh before we get to pulling that PR.
If you want to keep the learning process going, there are lots of links like this one that explain how it works with ohmyzsh, https://stackoverflow.com/questions/46939906/zsh-tab-completion-not-working
Yeah good idea, many thanks for the further zsh link, I’ll take a look at this 😃👍
On 5 May 2020, at 18:25, Randy Fay notifications@github.com wrote:
We should probably let the experts weigh in here. I haven't experimented with ohmyzsh and completions yet. I'll try ohmyzsh before we get to pulling that PR.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Wow, thank you so much @rfay! Looks like it works.
@karlosb you can copy this file as ~/.oh-my-zsh/custom/plugins/ddev/_ddev and add ddev in your plugins array in ~/.zshrc. Then apparently removing .zcompdump* and lauching compinit helps. Could you please confirm you can make it work? If so, we should prepare a pull request to integrate this file as a plugin into the Oh My ZSH distribution.
I think we may be able to have homebrew detect oh-my-zsh and put the _ddev file there.
Hi @felmab @rfay,
Ah it looks like I needed to keep _ddev within a ‘ddev’ folder within the plugins directory! So many thanks @felmab for the further updates on this.
I’ll give this a go first thing in the morning (UK time) and report straight back. 👍
On 5 May 2020, at 22:53, Randy Fay notifications@github.com wrote:
I think we may be able to have homebrew detect oh-my-zsh and put the _ddev file there.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
I think we may be able to have homebrew detect oh-my-zsh and put the _ddev file there.
@rfay The usual way is to add a plugin in Oh My ZSH, which can be optionally enabled in .zshrc. Now, I guess homebrew (can't say much about it, being an Archlinux user) could display a message to explain how to enable this plugin if it detects Oh My ZSH is present, or ask users what they want to do about it. Unlike Bash, the situation can be rather complex to deal with, as the user could use plain ZSH, or one of the many ZSH distributions like Oh My ZSH.
Also use Oh My ZSH - on desktop this is maybe the most commen use case..? I can test with Oh My ZSH if there is anything to test.
Hi @rfay @felmab
I've sorted the following:
Installed _ddev (ddev_zsh_autocompletes.zip) at both directories (as both exist):
~/.oh-my-zsh/plugins/ddev
~/.oh-my-zsh/custom/plugins/ddev
Upated ~/.zshrc file with the plugin 'ddev':
plugins=(git extract osx eecms npm node bower colored-man-pages last-working-dir colorize emoji ddev)
Also added to ~./zshrc
export fpath=(~/.zshfuncs $fpath)
Then ran the following:
source ~/.zshrc (to update Oh my zsh install)
rm -f ~/.zcompdump && compinit
Quit terminal and reloaded and tried typing:
ddev (and then tab for auto-complete)
And does not work?
@karlosb
Installed _ddev (ddev_zsh_autocompletes.zip) at both directories (as both exist):
~/.oh-my-zsh/plugins/ddev ~/.oh-my-zsh/custom/plugins/ddev
You only need to install it in ~/.oh-my-zsh/custom/plugins/ddev, not sure a duplicate plugin is a good thing. ~/.oh-my-zsh/plugins/ddev should be reserved for official plugins supported by Oh My ZSH (which is not yet the case).
Upated ~/.zshrc file with the plugin 'ddev':
plugins=(git extract osx eecms npm node bower colored-man-pages last-working-dir colorize emoji ddev)
Looks good.
Also added to ~./zshrc
export fpath=(~/.zshfuncs $fpath)
You don't need that. Oh My ZSH will internally deal with fpath.
Quit terminal and reloaded and tried typing:
ddev (and then tab for auto-complete)And does not work?
Please try hitting tab twice.
Hi @felmab
I have removed the following folder (and it's contents ie. _ddev):
~/.oh-my-zsh/plugins/ddev
Removed the following line from ~.zshrc:
export fpath=(~/.zshfuncs $fpath)
Ran:
source ~/.zshrc
Restarted terminal.
Then tried:
ddev (and then hit tab twice for auto-complete)
Still no luck getting it to work.
Any other ideas what may be wrong?
@karlosb could you give us the output of:
echo $plugins
echo $ZSH_CUSTOM
Hi @felmab
echo $plugins:
git extract osx eecms npm node bower colored-man-pages last-working-dir colorize z emoji ddev zsh-autosuggestions
echo $ZSH_CUSTOM
/Users/my_username/.oh-my-zsh/custom
@karlosb Mmmh don't know what to say but noting I have more than one .zcompdump file on my machine, the other one is called .zcompdump-MYHOSTNAME-VERSION.
Hi @felmab When you type ddev then double tab what list of options do you get?
On 6 May 2020, at 12:28, felmab notifications@github.com wrote:
@karlosb https://github.com/karlosb Mmmh don't know what to say but noting I have more than one .zcompdump file on my machine, the other one is called .zcompdump-MYHOSTNAME-VERSION.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/drud/ddev/issues/327#issuecomment-624594352, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWPHLHQMOEJUB2YWEBTHMDRQFCVRANCNFSM4DPMVBIQ.
@karlosb
~ ddev
auth -- A collection of authentication commands
composer -- Executes a composer command within the web container
config -- Create or modify a ddev project configuration in the current directory
debug -- A collection of debugging commands
delete -- Remove all project information (including database) for an existing proj
describe -- Get a detailed description of a running ddev project.
exec -- Execute a shell command in the container for a service. Uses the web ser
export-db -- Dump a database to stdout or to a file
hostname -- Manage your hostfile entries.
import-db -- Import a sql archive into the project.
import-files -- Pull the uploaded files directory of an existing project to the default
list -- List projects
logs -- Get the logs from your running services.
pause -- uses 'docker stop' to pause/stop the containers belonging to a project.
poweroff -- Completely stop all projects and containers
pull -- Pull files and database using a configured provider plugin.
restart -- Restart a project or several projects.
restore-snapshot -- Restore a project's database to the provided snapshot version.
share -- Share project on the internet via ngrok.
snapshot -- Create a database snapshot for one or more projects.
ssh -- Starts a shell session in the container for a service. Uses web service
start -- Start a ddev project.
stop -- Stop and remove the containers of a project. Does not lose or harm anyth
version -- print ddev version and component versions
Hi @felmab @rfay
Many thanks for the confirmation above.
I have it working now!
The .zcompdump files were not properly deleting from the ~/ directory with the following:
rm -f ~/.zcompdump && compinit
So I manually deleted ~/.zcompdump and two other similar files.
Ran:
compinit
Then:
source ~/.zshrc
and all is now working as expected!
@rfay do you agree with the inclusion of your code into the Oh My ZSH project? Is it released under an MIT-compatible license?
@karlosb @tgaertner, could you review and approve ("+1") this pull request?
@felmab The autocomplete is generated and would change a bit on every release. I don't object to it being in Oh My Zsh, but OTOH, it won't automatically be maintained that way... I was assuming that homebrew or the install script (or the user) would be putting the autocomplete where it belongs.
@rfay It would indeed be really cool if you decided to support both plain ZSH and Oh My ZSH.
I guess in that case you could add a ddev directory in $ZSH_CUSTOM/plugins if you detected its existence and the user agrees. However, maybe editing the plugins array should be up to the user.
Now, the installer is run as root, which makes it difficult to install it per user (Oh My ZSH is generally installed per user). I see that under Archlinux Bash completion is installed globally. One solution could be to install the plugin globally and advise the user to make a symbolic link...
Actually it was really silly of me to focus on Oh My ZSH plugins, dropping the completion file somewhere in /usr/share/zsh/functions/Completion works perfectly well.
/usr/local/share/zsh/site-functions also is in my fpath, even though this folder was never created.
Hi @felmab are you still looking for me to '+1' a pull request, or have things changed? (Sorry I'm pretty new to the whole github pull/review stuff!!!).
So I prefer to avoid using superuser privileges on installation, so a user-local $fpath entry would be better. If there's a predictable way to put it user-local, that will be great. I don't object to figuring out how to maintain it with Oh My Zsh if that can be kept up to date, etc.
Hi @felmab are you still looking for me to '+1' a pull request, or have things changed? (Sorry I'm pretty new to the whole github pull/review stuff!!!).
@karlosb I think I'll just close it since apparently DDEV installer will take care of it.
@rfay This is what my $fpath looks like (Archlinux):
$HOME/.oh-my-zsh/custom/plugins/ddev ... $HOME/.oh-my-zsh/plugins/git $HOME/.oh-my-zsh/plugins/composer $HOME/.oh-my-zsh/functions $HOME/.oh-my-zsh/completions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/functions/Calendar /usr/share/zsh/functions/Chpwd /usr/share/zsh/functions/Completion /usr/share/zsh/functions/Completion/Base /usr/share/zsh/functions/Completion/Linux /usr/share/zsh/functions/Completion/Unix /usr/share/zsh/functions/Completion/X /usr/share/zsh/functions/Completion/Zsh /usr/share/zsh/functions/Exceptions /usr/share/zsh/functions/Math /usr/share/zsh/functions/MIME /usr/share/zsh/functions/Misc /usr/share/zsh/functions/Newuser /usr/share/zsh/functions/Prompts /usr/share/zsh/functions/TCP /usr/share/zsh/functions/VCS_Info /usr/share/zsh/functions/VCS_Info/Backends /usr/share/zsh/functions/Zftp /usr/share/zsh/functions/Zle
$HOME/.oh-my-zsh/functions and $HOME/.oh-my-zsh/completions would have been good candidates but they would have to be created and the parent directory is managed by Git (~/.oh-my-zsh/custom is explicitly ignored), so back to creating a custom plugin in that case...
Or adding an entry in $fpath of course.
ddev can't add an entry to $fpath in any consistent way, it would mean editing .zshrc, I don't see that happening. I do wish there weren't so many ways to do things with zsh. When https://github.com/drud/ddev/pull/2234 gets reviews and a little more maturity, I'll try out Oh My Zsh and look at the installation options.
Most helpful comment
No @karlosb it will take some work to integrate the work mentioned above, if it works out we can hope it will be in a future release.