From e8dc23fe154a77a60cbe161a922ccd5574ad6350 Mon Sep 17 00:00:00 2001 From: Eduardo Bizarro Date: Tue, 25 Oct 2016 10:03:15 -0200 Subject: [PATCH] remove unused files and fix autocomplete suggestions --- plugins/yarn/_yarn | 57 ----------------------------------- plugins/yarn/yarn.plugin.zsh | 58 ++++++++++++++---------------------- 2 files changed, 22 insertions(+), 93 deletions(-) delete mode 100644 plugins/yarn/_yarn diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn deleted file mode 100644 index 6bf8e51f0..000000000 --- a/plugins/yarn/_yarn +++ /dev/null @@ -1,57 +0,0 @@ - - -# Credits to bower's awesome completion utility. -# -# yarn completion script, based on bower completion script. - -###-begin-yarn-completion-### -# -# Installation: yarn completion >> ~/.bashrc (or ~/.zshrc) -# Or, maybe: yarn completion > /usr/local/etc/bash_completion.d/yarn -# - -COMP_WORDBREAKS=${COMP_WORDBREAKS/=/} -COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} -export COMP_WORDBREAKS - -if type complete &>/dev/null; then - _yarn_completion () { - local si="$IFS" - IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \ - COMP_LINE="$COMP_LINE" \ - COMP_POINT="$COMP_POINT" \ - yarn completion -- "${COMP_WORDS[@]}" \ - 2>/dev/null)) || return $? - IFS="$si" - } - complete -F _yarn_completion yarn --help -elif type compdef &>/dev/null; then - _yarn_completion() { - si=$IFS - compadd -- $(COMP_CWORD=$((CURRENT-1)) \ - COMP_LINE=$BUFFER \ - COMP_POINT=0 \ - yarn completion -- "${words[@]}" \ - 2>/dev/null) - IFS=$si - } - compdef _yarn_completion yarn --help -elif type compctl &>/dev/null; then - _yarn_completion () { - local cword line point words si - read -Ac words - read -cn cword - let cword-=1 - read -l line - read -ln point - si="$IFS" - IFS=$'\n' reply=($(COMP_CWORD="$cword" \ - COMP_LINE="$line" \ - COMP_POINT="$point" \ - yarn completion -- "${words[@]}" \ - 2>/dev/null)) || return $? - IFS="$si" - } - compctl -K _yarn_completion yarn --help -fi -###-end-yarn-completion-### diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 349e081d7..47c503acb 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -1,16 +1,11 @@ alias yi="yarn install" -_yarn_installed_packages () { - yarn_package_list=$(yarn ls --no-color 2>/dev/null| awk 'NR>3{print p}{p=$0}'| cut -d ' ' -f 2|sed 's/#.*//') -} _yarn () { - local -a _1st_arguments _no_color _dopts _dev _production + local -a _1st_arguments _dopts _dev _production local expl typeset -A opt_args - _no_color=('--no-color[Do not print colors (available in all commands)]') - _dopts=( '(--force)--force[This refetches all packages, even ones that were previously installed.]' ) @@ -27,26 +22,25 @@ _yarn () _production=('(--production)--production[Do not install project devDependencies]') _1st_arguments=( - 'help:Display help information about yarn' \ - 'init:Initialize for the development of a package.' \ - 'add:Add a package to use in your current package.' \ - 'install:Install all the dependencies listed within package.json in the local node_modules folder.' \ - 'publish:Publish a package to a package manager.' \ - 'remove:Remove a package that will no longer be used in your current package.' \ - 'cache:Clear the local cache. It will be populated again the next time yarn or yarn install is run.' \ - 'clean:Frees up space by removing unnecessary files and folders from dependencies.' \ - 'check:Verifies that versions of the package dependencies in the current project’s package.json matches that of yarn’s lock file.' \ - 'ls:List all installed packages.' \ - 'global:Makes binaries available to use on your operating system.' \ - 'info: [] - fetch information about a package and return it in a tree format.' \ - 'outdated:Checks for outdated package dependencies.' \ - 'run:Runs a defined package script.' \ - 'self-update:Updates Yarn to the latest version.' \ - 'upgrade:Upgrades packages to their latest version based on the specified range.' \ - 'why: - Show information about why a package is installed.' + 'help:Display help information about yarn' \ + 'init:Initialize for the development of a package.' \ + 'add:Add a package to use in your current package.' \ + 'install:Install all the dependencies listed within package.json in the local node_modules folder.' \ + 'publish:Publish a package to a package manager.' \ + 'remove:Remove a package that will no longer be used in your current package.' \ + 'cache:Clear the local cache. It will be populated again the next time yarn or yarn install is run.' \ + 'clean:Frees up space by removing unnecessary files and folders from dependencies.' \ + 'check:Verifies that versions of the package dependencies in the current project’s package.json matches that of yarn’s lock file.' \ + 'ls:List all installed packages.' \ + 'global:Makes binaries available to use on your operating system.' \ + 'info: [] - fetch information about a package and return it in a tree format.' \ + 'outdated:Checks for outdated package dependencies.' \ + 'run:Runs a defined package script.' \ + 'self-update:Updates Yarn to the latest version.' \ + 'upgrade:Upgrades packages to their latest version based on the specified range.' \ + 'why: - Show information about why a package is installed.' ) _arguments \ - $_no_color \ '*:: :->subcmds' && return 0 if (( CURRENT == 1 )); then @@ -59,7 +53,6 @@ _yarn () _arguments \ $_dopts \ $_dev \ - $_no_color \ $_production ;; install) @@ -72,21 +65,14 @@ _yarn () ;; update) _arguments \ - $_dopts \ - $_no_color \ - _yarn_installed_packages - compadd "$@" $(echo $yarn_package_list) - ;; - uninstall) - _arguments \ - $_no_color \ $_dopts - _yarn_installed_packages - compadd "$@" $(echo $yarn_package_list) + ;; + remove) + _arguments \ + $_dopts ;; *) _arguments \ - $_no_color \ ;; esac