Add new zsh completions

This commit is contained in:
Jarred Sumner
2021-12-18 21:44:17 -08:00
parent 5f80f9c814
commit 059f01d23a
3 changed files with 272 additions and 2 deletions

View File

@@ -15,12 +15,51 @@ _bun() {
IFS=$'\n' scripts_list=($(SHELL=zsh bun getcompletes i))
compadd $scripts_list && ret=0
main_commands=('bun:"Generate a bundle" create:"Create a new project" dev:"Start a dev server" help:"Show command help" run:"Run a script or package bin" upgrade:"Upgrade to the latest version of Bun"')
main_commands=('add\:"Add a dependency to package.json" bun\:"Generate a bundle" create\:"Create a new project" dev\:"Start a dev server" help\:"Show command help" install\:"Install packages from package.json" remove\:"Remove a dependency from package.json" run\:"Run a script or package bin" upgrade\:"Upgrade to the latest version of Bun"')
main_commands=($main_commands)
_alternative "args:Bun:(($main_commands))"
;;
args)
case $line[1] in
add)
# ---- Command: add
_arguments -s -C \
'1: :->cmd1' \
'*: :->package' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--registry[Change default registry (default: \$BUN_CONFIG_REGISTRY || \$npm_config_registry)]:registry' \
'--token[Authentication token used for npm registry requests (default: \$npm_config_token)]:token' \
'-y[Write a yarn.lock file (yarn v1)]' \
'--yarn[Write a yarn.lock file (yarn v1)]' \
'--production[Don'"'"'t install devDependencies]' \
'--optional[Add dependency to optionalDependencies]' \
'--development[Add dependency to devDependencies]' \
'-d[Add dependency to devDependencies]' \
'-p[Don'"'"'t install devDependencies]' \
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
'--verbose[Excessively verbose logging]' \
'--cwd[Set a specific cwd]:cwd' \
'--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir")' \
'--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' &&
ret=0
case $state in
package) ;;
esac
;;
bun)
# ---- Command: bun
@@ -164,6 +203,53 @@ _bun() {
ret=0
;;
install)
# ---- Command: help install
_arguments -s -C \
'1: :->cmd1' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
remove)
# ---- Command: help remove
_arguments -s -C \
'1: :->cmd1' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
run)
# ---- Command: help run
_arguments -s -C \
'1: :->cmd1' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
create)
@@ -275,6 +361,73 @@ _bun() {
;;
esac
;;
install)
# ---- Command: install
_arguments -s -C \
'1: :->cmd1' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--registry[Change default registry (default: \$BUN_CONFIG_REGISTRY || \$npm_config_registry)]:registry' \
'--token[Authentication token used for npm registry requests (default: \$npm_config_token)]:token' \
'-y[Write a yarn.lock file (yarn v1)]' \
'--yarn[Write a yarn.lock file (yarn v1)]' \
'--production[Don'"'"'t install devDependencies]' \
'-p[Don'"'"'t install devDependencies]' \
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
'--verbose[Excessively verbose logging]' \
'--cwd[Set a specific cwd]:cwd' \
'--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir")' \
'--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' &&
ret=0
;;
remove)
# ---- Command: remove
_arguments -s -C \
'1: :->cmd1' \
'*: :->package' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--registry[Change default registry (default: \$BUN_CONFIG_REGISTRY || \$npm_config_registry)]:registry' \
'--token[Authentication token used for npm registry requests (default: \$npm_config_token)]:token' \
'-y[Write a yarn.lock file (yarn v1)]' \
'--yarn[Write a yarn.lock file (yarn v1)]' \
'--production[Don'"'"'t install devDependencies]' \
'-p[Don'"'"'t install devDependencies]' \
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
'--verbose[Excessively verbose logging]' \
'--cwd[Set a specific cwd]:cwd' \
'--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir")' \
'--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' &&
ret=0
case $state in
package) ;;
esac
;;
run)

View File

@@ -102,6 +102,122 @@ subcommands:
- &port name: port
type: int
summary: Port number
install:
summary: Install packages from package.json
options:
- name: registry
type: string
summary: "Change default registry (default: $BUN_CONFIG_REGISTRY || $npm_config_registry)"
- name: token
type: string
summary: "Authentication token used for npm registry requests (default: $npm_config_token)"
- y -- "Write a yarn.lock file (yarn v1)"
- yarn -- "Write a yarn.lock file (yarn v1)"
- production -- "Don't install devDependencies"
- p -- "Don't install devDependencies"
- no-save --
- dry-run -- "Don't install anything"
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
- name: lockfile
type: string
summary: "Store & load a lockfile at a specific filepath"
- name: cache-dir
type: string
summary: "Store & load cached data from a specific directory path"
- no-cache -- "Ignore manifest cache entirely"
- silent -- "Don't output anything"
- verbose -- "Excessively verbose logging"
- name: cwd
type: string
summary: "Set a specific cwd"
- name: backend
summary: "Platform-specific optimizations for installing dependencies"
type: string
enum: ["clonefile", "copyfile", "hardlink", "clonefile_each_dir"]
- name: link-native-bins
summary: 'Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo'
add:
summary: Add a dependency to package.json
options:
- name: registry
type: string
summary: "Change default registry (default: $BUN_CONFIG_REGISTRY || $npm_config_registry)"
- name: token
type: string
summary: "Authentication token used for npm registry requests (default: $npm_config_token)"
- y -- "Write a yarn.lock file (yarn v1)"
- yarn -- "Write a yarn.lock file (yarn v1)"
- production -- "Don't install devDependencies"
- optional -- "Add dependency to optionalDependencies"
- development -- "Add dependency to devDependencies"
- d -- "Add dependency to devDependencies"
- p -- "Don't install devDependencies"
- no-save --
- dry-run -- "Don't install anything"
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
- name: lockfile
type: string
summary: "Store & load a lockfile at a specific filepath"
- name: cache-dir
type: string
summary: "Store & load cached data from a specific directory path"
- no-cache -- "Ignore manifest cache entirely"
- silent -- "Don't output anything"
- verbose -- "Excessively verbose logging"
- name: cwd
type: string
summary: "Set a specific cwd"
- name: backend
summary: "Platform-specific optimizations for installing dependencies"
type: string
enum: ["clonefile", "copyfile", "hardlink", "clonefile_each_dir"]
- name: link-native-bins
summary: 'Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo'
parameters:
- name: package
multiple: true
type: string
required: true
remove:
summary: Remove a dependency from package.json
options:
- name: registry
type: string
summary: "Change default registry (default: $BUN_CONFIG_REGISTRY || $npm_config_registry)"
- name: token
type: string
summary: "Authentication token used for npm registry requests (default: $npm_config_token)"
- y -- "Write a yarn.lock file (yarn v1)"
- yarn -- "Write a yarn.lock file (yarn v1)"
- production -- "Don't install devDependencies"
- p -- "Don't install devDependencies"
- no-save --
- dry-run -- "Don't install anything"
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
- name: lockfile
type: string
summary: "Store & load a lockfile at a specific filepath"
- name: cache-dir
type: string
summary: "Store & load cached data from a specific directory path"
- no-cache -- "Ignore manifest cache entirely"
- silent -- "Don't output anything"
- verbose -- "Excessively verbose logging"
- name: cwd
type: string
summary: "Set a specific cwd"
- name: backend
summary: "Platform-specific optimizations for installing dependencies"
type: string
enum: ["clonefile", "copyfile", "hardlink", "clonefile_each_dir"]
- name: link-native-bins
summary: 'Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo'
parameters:
- name: package
multiple: true
type: string
required: true
parameters:
- name: sasdasdds