-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…v#2234) * Bump spf13/cobra to v1.0.0 * Basic generation of zsh, fish, and powershell * Add zsh instructions to install.sh * Make the install_ddev.sh script install zsh completions if possible * Add docs for completions * Create a tarball of completion scripts
- Loading branch information
Showing
40 changed files
with
2,396 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
## Shell Completion | ||
|
||
Most people like to have shell completion on the command line. In other words, when you're typing a command, you can hit <TAB> and the shell will show you what the options are. For example, if you type `ddev <TAB>`, you'll see all the possible commands. `ddev debug <TAB>` will show you the options for the command. And `ddev list -<TAB>` will show you all the flags available for `ddev list`. | ||
|
||
Shells like bash and zsh need help to do this though, they have to know what the options are. DDEV-Local provides the necessary hint scripts, and if you use homebrew, they get installed automatically. But if you use oh-my-zsh, for example, you may have to manually install the hint script. | ||
|
||
### tar Archive of Completion Scripts for Manual Deployment | ||
|
||
Although most people will use techniques like homebrew for installation, a tar archive of the shell completion scripts is available in each release, called "ddev_shell_completion_scripts.<version>.tar.gz". If you need to manually install, you can download and untar the scripts, then copy them as needed to where they have to go. For example, `sudo cp ddev_bash_completion.sh /etc/bash_completion.d/ddev`. | ||
|
||
Note that scripts for the fish shell and Windows Powershell are also provided, but no instructions are given here for deploying them. | ||
|
||
## Bash Completion | ||
|
||
**Bash Completion with Homebrew**: The easiest way to use bash completion on either macOS or Linux is to install with homebrew. `brew install bash-completion`. When you install it though, it will warn you with something like this, which may vary on your system. | ||
|
||
```bash | ||
Add the following line to your ~/.bash_profile: | ||
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" | ||
``` | ||
|
||
*You need to add the suggested line to your ~/.bash_profile or ~/.profile to get it to work*, and then in the current shell you need tou `source ~/.bash_profile` or `source ~/.profile` to make it take effect. (You can also just open a new shell window.) | ||
|
||
Then, if you're installing ddev from homebrew, each new release will automatically get a refreshed completions script. | ||
|
||
**Bash Completion without Homebrew**: The completion script is exactly the same, it's just that you have to install it yourself. Each system may have a slightly different technique, and you'll need to figure it out. On Debian/Ubuntu, you would use [these instructions](http://crsouza.com/2008/07/28/enabling-bash-autocompletion-on-debian/) to enable bash-completion, and then `sudo mkdir -p /etc/bash_completion.d && sudo cp ddev_bash_completion.sh /etc/bash_completion.d`. This deploys the ddev_bash_completion.sh script where it needs to be. Again, every Linux distro has a different technique, and you may have to figure yours out. | ||
|
||
### Zsh Completion | ||
|
||
**Zsh Completion with Homebrew**: This works exactly the same as bash completion. `brew install zsh-completion`. You'll get instructions something like this: | ||
|
||
```bash | ||
if type brew &>/dev/null; then | ||
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH | ||
|
||
autoload -Uz compinit | ||
compinit | ||
fi | ||
|
||
You may also need to force rebuild `zcompdump`: | ||
|
||
rm -f ~/.zcompdump; compinit | ||
|
||
Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting | ||
to load these completions, you may need to run this: | ||
|
||
chmod go-w '/usr/local/share' | ||
``` | ||
So follow those instructions and your zsh should be set up. | ||
### Oh-My-Zsh Completion | ||
If you installed zsh with homebrew, ddev's completions will be automatically installed when you `brew install ddev`. | ||
Otherwise, Oh-My-Zsh may be set up very differently in different places, so as a power zsh user you'll need to put ddev_bash_completion.sh where it belongs. `echo $fpath` will show you the places that it's most likely to belong. An obvious choice is ~/.oh-my-zsh/completions if that exists, so you can `mkdir -p ~/.oh-my-zsh/completions && cp ddev_zsh_completions.sh ~/.oh-my-zsh/completions/_ddev` and then `autoload -Uz compinit && compinit`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.