diff --git a/completions/bun.bash b/completions/bun.bash index bba0783665..9537cdb880 100644 --- a/completions/bun.bash +++ b/completions/bun.bash @@ -106,7 +106,7 @@ _bun_completions() { --backend) case "${COMP_WORDS[1]}" in a|add|remove|rm|install|i) - COMPREPLY=( $(compgen -W "clonefile copyfile hardlink clonefile_each_dir" -- "${cur_word}") ); + COMPREPLY=( $(compgen -W "clonefile copyfile hardlink clonefile_each_dir symlink" -- "${cur_word}") ); ;; esac return ;; @@ -117,7 +117,7 @@ _bun_completions() { COMPREPLY=( $(compgen -W "automatic classic" -- "${cur_word}") ); return;; --platform) - COMPREPLY=( $(compgen -W "browser node" -- "${cur_word}") ); + COMPREPLY=( $(compgen -W "browser node bun" -- "${cur_word}") ); return;; -l|--loader) [[ "${cur_word}" =~ (:) ]] && { @@ -134,7 +134,7 @@ _bun_completions() { "${PACKAGE_OPTIONS[ADD_OPTIONS_LONG]} ${PACKAGE_OPTIONS[ADD_OPTIONS_SHORT]} ${PACKAGE_OPTIONS[SHARED_OPTIONS_LONG]} ${PACKAGE_OPTIONS[SHARED_OPTIONS_SHORT]}" \ "${PACKAGE_OPTIONS[ADD_OPTIONS_SHORT]} ${PACKAGE_OPTIONS[SHARED_OPTIONS_SHORT]}" return;; - remove|rm|i|install) + remove|rm|i|install|link|unlink) _long_short_completion \ "${PACKAGE_OPTIONS[REMOVE_OPTIONS_LONG]} ${PACKAGE_OPTIONS[REMOVE_OPTIONS_SHORT]} ${PACKAGE_OPTIONS[SHARED_OPTIONS_LONG]} ${PACKAGE_OPTIONS[SHARED_OPTIONS_SHORT]}" \ "${PACKAGE_OPTIONS[REMOVE_OPTIONS_SHORT]} ${PACKAGE_OPTIONS[SHARED_OPTIONS_SHORT]}"; diff --git a/completions/bun.fish b/completions/bun.fish index 60bb213619..74ac009d90 100644 --- a/completions/bun.fish +++ b/completions/bun.fish @@ -53,7 +53,7 @@ end set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global set -l bun_install_boolean_flags_descriptions "Write a yarn.lock file (yarn v1)" "Don't install devDependencies" "Add dependency to optionalDependencies" "Add dependency to devDependencies" "Don't install devDependencies" "Don't install anything" "Always request the latest versions from the registry & reinstall all dependenices" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging" "Use global folder" -set -l bun_builtin_cmds dev create help bun upgrade discord run install remove add init +set -l bun_builtin_cmds dev create help bun upgrade discord run install remove add init link unlink set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add init set -l bun_builtin_cmds_without_bun dev create help upgrade run discord install remove add init set -l bun_builtin_cmds_without_create dev help bun upgrade discord run install remove add init diff --git a/completions/bun.zsh b/completions/bun.zsh index af2c89e4aa..57a56c6c88 100644 --- a/completions/bun.zsh +++ b/completions/bun.zsh @@ -58,7 +58,7 @@ _bun() { '--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")' \ + '--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir", "symlink")' \ '--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' && ret=0 @@ -69,6 +69,77 @@ _bun() { esac ;; + unlink) + + # ---- Command: unlink + _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)]' \ + '--global[Add a package globally]' \ + '--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", "symlink")' \ + '--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' && + ret=0 + + ;; + link) + + # ---- Command: unlink + _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)]' \ + '--global[Add a package globally]' \ + '--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", "symlink")' \ + '--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' && + ret=0 + + ;; + bun) # ---- Command: bun @@ -393,7 +464,7 @@ _bun() { '--cwd[Set a specific cwd]:cwd' \ '-g[Add a package globally]' \ '--global[Add a package globally]' \ - '--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir")' \ + '--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir", "symlink")' \ '--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' && ret=0 @@ -425,7 +496,7 @@ _bun() { '--no-cache[Ignore manifest cache entirely]' \ '--silent[Don'"'"'t output anything]' \ '--verbose[Excessively verbose logging]' \ - '--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir")' \ + '--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir", "symlink")' \ '--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' && ret=0 diff --git a/src/cli.zig b/src/cli.zig index 743527a93f..3d1e25abff 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -696,7 +696,9 @@ pub const HelpCommand = struct { \\> run test Run JavaScript with bun, a package.json script, or a bin \\> install Install dependencies for a package.json (bun i) \\> add {s:<16} Add a dependency to package.json (bun a) + \\> link Link an npm package globally \\> remove {s:<16} Remove a dependency from package.json (bun rm) + \\> unlink Globally unlink an npm package \\ \\> upgrade Get the latest version of bun \\> completions Install shell completions for tab-completion @@ -891,10 +893,11 @@ pub const Command = struct { // "build", "install", "add", - "remove", "run", + "link", + "unlink", + "remove", "dev", - "install", "create", "bun", "upgrade",