ivapopova

ng-completion.sh

May 7th, 2018
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.17 KB | None | 0 0
  1. ###-begin-ng-completion###
  2. #
  3.  
  4. # ng command completion script
  5. #   This command supports 3 cases.
  6. #   1. (Default case) It prints a common completion initialisation for both Bash and Zsh.
  7. #      It is the result of either calling "ng completion" or "ng completion -a".
  8. #   2. Produce Bash-only completion: "ng completion -b" or "ng completion --bash".
  9. #   3. Produce Zsh-only completion: "ng completion -z" or "ng completion --zsh".
  10. #
  11. # Usage: . <(ng completion --bash) # place it appropriately in .bashrc or
  12. #        . <(ng completion --zsh) # find a spot for it in .zshrc
  13. #
  14. _ng_completion() {
  15.   local cword pword opts
  16.  
  17.   COMPREPLY=()
  18.   cword=${COMP_WORDS[COMP_CWORD]}
  19.   pword=${COMP_WORDS[COMP_CWORD - 1]}
  20.  
  21.   case ${pword} in
  22.     ng|help) opts="--version -v b build completion doc e e2e eject g generate get help l lint n new s serve server set t test update v version xi18n" ;;
  23.     b|build) opts="--aot --app --base-href --build-optimizer --bundle-dependencies --common-chunk --delete-output-path --deploy-url --environment --extract-css --extract-licenses --i18n-file --i18n-format --locale --missing-translation --named-chunks --output-hashing --output-path --poll --preserve-symlinks --progress --service-worker --show-circular-dependencies --skip-app-shell --sourcemaps --stats-json --subresource-integrity --target --vendor-chunk --verbose --watch -a -aot -bh -buildOptimizer -bundleDependencies -cc -d -dop -e -ec -extractLicenses -i18nFile -i18nFormat -locale -missingTranslation -nc -oh -op -poll -pr -preserveSymlinks -scd -skipAppShell -sm -sri -statsJson -sw -t -v -vc -w" ;;
  24.     completion) opts="--all --bash --zsh -a -b -z" ;;
  25.     doc) opts="--search -s" ;;
  26.     e|e2e) opts="--aot --app --base-href --build-optimizer --bundle-dependencies --common-chunk --config --delete-output-path --deploy-url --disable-host-check --element-explorer --environment --extract-css --extract-licenses --hmr --host --i18n-file --i18n-format --live-reload --locale --missing-translation --named-chunks --open --output-hashing --output-path --poll --port --preserve-symlinks --progress --proxy-config --public-host --serve --serve-path --service-worker --show-circular-dependencies --skip-app-shell --sourcemaps --specs --ssl --ssl-cert --ssl-key --subresource-integrity --suite --target --vendor-chunk --verbose --watch --webdriver-update -H -a -aot -bh -buildOptimizer -bundleDependencies -c -cc -d -disableHostCheck -dop -e -ec -ee -extractLicenses -hmr -i18nFile -i18nFormat -live-reload-client -locale -lr -missingTranslation -nc -o -oh -op -p -pc -poll -pr -preserveSymlinks -s -scd -servePath -skipAppShell -sm -sp -sri -ssl -sslCert -sslKey -su -sw -t -v -vc -w -wu" ;;
  27.     eject) opts="--aot --app --base-href --build-optimizer --bundle-dependencies --common-chunk --delete-output-path --deploy-url --environment --extract-css --extract-licenses --force --i18n-file --i18n-format --locale --missing-translation --named-chunks --output-hashing --output-path --poll --preserve-symlinks --progress --service-worker --show-circular-dependencies --skip-app-shell --sourcemaps --subresource-integrity --target --vendor-chunk --verbose --watch -a -aot -bh -buildOptimizer -bundleDependencies -cc -d -dop -e -ec -extractLicenses -force -i18nFile -i18nFormat -locale -missingTranslation -nc -oh -op -poll -pr -preserveSymlinks -scd -skipAppShell -sm -sri -sw -t -v -vc -w" ;;
  28.     g|generate) opts="--app --collection --dry-run --force --lint-fix -a -c -d -f -lf" ;;
  29.     get) opts="--global -global" ;;
  30.     help) opts="--short -s" ;;
  31.     l|lint) opts="--fix --force --format --type-check -fix -force -t -typeCheck" ;;
  32.     n|new) opts="--collection --dry-run --verbose -c -d -v" ;;
  33.     s|serve|server) opts="--aot --app --base-href --build-optimizer --bundle-dependencies --common-chunk --delete-output-path --deploy-url --disable-host-check --environment --extract-css --extract-licenses --hmr --host --i18n-file --i18n-format --live-reload --locale --missing-translation --named-chunks --open --output-hashing --output-path --poll --port --preserve-symlinks --progress --proxy-config --public-host --serve-path --service-worker --show-circular-dependencies --skip-app-shell --sourcemaps --ssl --ssl-cert --ssl-key --subresource-integrity --target --vendor-chunk --verbose --watch -H -a -aot -bh -buildOptimizer -bundleDependencies -cc -d -disableHostCheck -dop -e -ec -extractLicenses -hmr -i18nFile -i18nFormat -live-reload-client -locale -lr -missingTranslation -nc -o -oh -op -p -pc -poll -pr -preserveSymlinks -scd -servePath -skipAppShell -sm -sri -ssl -sslCert -sslKey -sw -t -v -vc -w" ;;
  34.     set) opts="--global -g" ;;
  35.     t|test) opts="--app --browsers --code-coverage --colors --config --environment --log-level --poll --port --preserve-symlinks --progress --reporters --single-run --sourcemaps --watch -a -browsers -c -cc -colors -e -logLevel -poll -port -preserveSymlinks -progress -reporters -sm -sr -w" ;;
  36.     update) opts="--dry-run --next -d -next" ;;
  37.     xi18n) opts="--app --i18n-format --locale --out-file --output-path --progress --verbose -a -f -l -of -op -progress -verbose" ;;
  38.     *) opts="" ;;
  39.   esac
  40.  
  41.   COMPREPLY=( $(compgen -W '${opts}' -- $cword) )
  42.  
  43.   return 0
  44. }
  45.  
  46. complete -o default -F _ng_completion ng
  47. ###-end-ng-completion###
Advertisement
Add Comment
Please, Sign In to add comment