aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-12-18 21:44:17 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-12-18 21:44:17 -0800
commit059f01d23a526222926ea96673edb0674549fcdb (patch)
tree559d43524f388018d1fe727e3e4b92e5bdb67218
parent5f80f9c81496ad817a09f9cfc35e467e1e9b39e2 (diff)
downloadbun-059f01d23a526222926ea96673edb0674549fcdb.tar.gz
bun-059f01d23a526222926ea96673edb0674549fcdb.tar.zst
bun-059f01d23a526222926ea96673edb0674549fcdb.zip
Add new zsh completions
-rw-r--r--completions/bun.zsh155
-rw-r--r--completions/spec.yaml116
-rw-r--r--src/cli.zig3
3 files changed, 272 insertions, 2 deletions
diff --git a/completions/bun.zsh b/completions/bun.zsh
index bd84a383c..f3ba77d63 100644
--- a/completions/bun.zsh
+++ b/completions/bun.zsh
@@ -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)
@@ -276,6 +362,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)
# ---- Command: run
diff --git a/completions/spec.yaml b/completions/spec.yaml
index ccab35879..3a402b757 100644
--- a/completions/spec.yaml
+++ b/completions/spec.yaml
@@ -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
diff --git a/src/cli.zig b/src/cli.zig
index f876bbf41..5f8d95850 100644
--- a/src/cli.zig
+++ b/src/cli.zig
@@ -475,6 +475,7 @@ const HelpCommand = struct {
"wrangler@beta",
"@compiled/react",
"@remix-run/dev",
+ "contentlayer",
};
pub fn printWithReason(comptime reason: Reason) void {
@@ -491,7 +492,7 @@ const HelpCommand = struct {
\\> <r> <b><green>install<r> Install dependencies for a package.json <d>(bun i)<r>
\\> <r> <b><blue>add <r><d> {s:<16}<r> Add a dependency to package.json <d>(bun a)<r>
\\> <r> remove <r><d> {s:<16}<r> Remove a dependency from package.json <d>(bun rm)<r>
- \\> <r> pm <r> More package manager-related subcommands
+ \\> <r> pm <r> More package manager-related subcommands
\\
\\> <r> <b><blue>upgrade <r> Get the latest version of Bun
\\> <r> <b><d>completions<r> Install shell completions for tab-completion