mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Add bun link and bun unlink to completions
This commit is contained in:
@@ -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]}";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -696,7 +696,9 @@ pub const HelpCommand = struct {
|
||||
\\> <r> <b><magenta>run <r><d> test <r> Run JavaScript with bun, a package.json script, or a bin<r>
|
||||
\\> <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> <b><blue>link <r> Link an npm package globally<r>
|
||||
\\> <r> remove <r><d> {s:<16}<r> Remove a dependency from package.json <d>(bun rm)<r>
|
||||
\\> <r> unlink <r> Globally unlink an npm package
|
||||
\\
|
||||
\\> <r> <b><blue>upgrade <r> Get the latest version of bun
|
||||
\\> <r> <b><d>completions<r> 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",
|
||||
|
||||
Reference in New Issue
Block a user