/yarn-completion

Bash completion for Yarn

Primary LanguageShellMIT LicenseMIT

yarn-completion

Bash ^4.x completion for Yarn

Installation

To enable on-demand completion loading, download the completion file to the predefined bash-completion user directory.

$ curl -o "${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions/yarn" https://raw.githubusercontent.com/dsifford/yarn-completion/master/yarn-completion.bash

Installation on macOS with Homebrew

  1. bash version ^4.x.x is required.

    brew install bash
    
    # Add installed bash to /etc/shells
    sudo echo /usr/local/bin/bash >> /etc/shells
    # or
    echo /usr/local/bin/bash | sudo tee -a /etc/shells
    
    # Set installed bash as your default login shell
    chsh -s /usr/local/bin/bash
  2. Install bash-completion@2 if you have not done it yet:

    brew install bash-completion@2
    ## + copy one line to ~/.bash_profile as instructed by brew after bash-completion setup
  3. Install yarn-completion:

    mkdir -p "${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions"
    curl -o "${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions/yarn" https://raw.githubusercontent.com/dsifford/yarn-completion/master/yarn-completion.bash
  4. Restart Terminal.

FAQ

Will you support bash 3?

No. Bash 3 is now 9 years outdated (at time of writing). There is no conceivable reason why anybody would or should still be using bash 3. Upgrade to the latest version of bash.

Completion fails for run scripts that contains a colon.

This is a feature of bash. Enable menu-complete in your ~/.inputrc if you'd prefer a more seamless experience.

# Cycle through completions, rather than dumping all options
TAB:       menu-complete
"\e[Z":    menu-complete-backward

License

MIT