···3232 string split ' ' (bun getcompletes j)
3333end
34343535-function bun_fish_is_nth_token --description 'Test if current token is on Nth place' --argument-names n
3636- set -l tokens (commandline -poc)
3737- set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
3838- test (count $tokens) -eq "$n"
3939-end
3535+set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global
3636+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 dependencies" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging" "Use global folder"
40374141-function __bun_command_count --argument-names n
4242- set -l cmds (commandline -poc)
3838+set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add init pm x
3939+set -l bun_builtin_cmds_accepting_flags create help bun upgrade discord run init link unlink pm x
43404444- test (count cmds) -eq "$n"
4141+function __bun_complete_bins_scripts --inherit-variable bun_builtin_cmds_without_run -d "Emit bun completions for bins and scripts"
4242+ # Do nothing if we already have a builtin subcommand,
4343+ # or any subcommand other than "run".
4444+ if __fish_seen_subcommand_from $bun_builtin_cmds_without_run
4545+ or not __fish_use_subcommand && not __fish_seen_subcommand_from run
4646+ return
4747+ end
4848+ # Do we already have a bin or script subcommand?
4949+ set -l bins (__fish__get_bun_bins)
5050+ if __fish_seen_subcommand_from $bins
5151+ return
5252+ end
5353+ # Scripts have descriptions appended with a tab separator.
5454+ # Strip off descriptions for the purposes of subcommand testing.
5555+ set -l scripts (__fish__get_bun_scripts)
5656+ if __fish_seen_subcommand_from $(string split \t -f 1 -- $scripts)
5757+ return
5858+ end
5959+ # Emit scripts.
6060+ for script in $scripts
6161+ echo $script
6262+ end
6363+ # Emit binaries and JS files (but only if we're doing `bun run`).
6464+ if __fish_seen_subcommand_from run
6565+ for bin in $bins
6666+ echo "$bin"\t"package bin"
6767+ end
6868+ for file in (__fish__get_bun_bun_js_files)
6969+ echo "$file"\t"Bun.js"
7070+ end
7171+ end
4572end
46734747-function __bun_last_cmd --argument-names n
4848- set -l cmds (commandline -poc)
49745050- test "(cmds[-1])" = "$n"
5151-end
5252-5353-set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global
5454-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"
5555-5656-set -l bun_builtin_cmds dev create help bun upgrade discord run install remove add init link unlink pm x
5757-set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add init pm x
5858-set -l bun_builtin_cmds_without_bun dev create help upgrade run discord install remove add init pm x
5959-set -l bun_builtin_cmds_without_create dev help bun upgrade discord run install remove add init pm x
6060-set -l bun_builtin_cmds_without_install create dev help bun upgrade discord run remove add init pm x
6161-set -l bun_builtin_cmds_without_remove create dev help bun upgrade discord run install add init pm x
6262-set -l bun_builtin_cmds_without_add create dev help bun upgrade discord run remove install init pm x
6363-set -l bun_builtin_cmds_without_pm create dev help bun upgrade discord run init pm x
6464-6565-# clear
7575+# Clear existing completions
6676complete -e -c bun
67777878+# Dynamically emit scripts and binaries
7979+complete -c bun -f -a "(__bun_complete_bins_scripts)"
8080+8181+# Complete flags if we have no subcommand or a flag-friendly one.
8282+set -l flag_applies "__fish_use_subcommand; or __fish_seen_subcommand_from $bun_builtin_cmds_accepting_flags"
6883complete -c bun \
6969- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a '(__fish__get_bun_scripts)' -d script
8484+ -n $flag_applies --no-files -s u -l origin -r -d 'Server URL. Rewrites import paths'
7085complete -c bun \
7171- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_bins)' -d 'package bin'
8686+ -n $flag_applies --no-files -s p -l port -r -d 'Port number to start server from'
7287complete -c bun \
7373- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_scripts)' -d script
8888+ -n $flag_applies --no-files -s d -l define -r -d 'Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:\"development\"'
7489complete -c bun \
7575- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_bun_js_files)' -d 'Bun.js'
9090+ -n $flag_applies --no-files -s e -l external -r -d 'Exclude module from transpilation (can use * wildcards). ex: -e react'
7691complete -c bun \
7777- -n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __fish_use_subcommand" -a run -f -d 'Run a script or bin'
9292+ -n $flag_applies --no-files -l use -r -d 'Use a framework (ex: next)'
7893complete -c bun \
7979- -n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s u -l origin -r -d 'Server URL. Rewrites import paths'
8080-complete -c bun \
8181- -n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s p -l port -r -d 'Port number to start server from'
8282-complete -c bun \
8383- -n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s d -l define -r -d 'Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:\"development\"'
8484-complete -c bun \
8585- -n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s e -l external -r -d 'Exclude module from transpilation (can use * wildcards). ex: -e react'
8686-complete -c bun \
8787- -n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -l use -r -d 'Use a framework (ex: next)'
8888-complete -c bun \
8989- -n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -l hot -r -d 'Enable hot reloading in Bun\'s JavaScript runtime'
9494+ -n $flag_applies --no-files -l hot -r -d 'Enable hot reloading in Bun\'s JavaScript runtime'
90959696+# Complete dev and create as first subcommand.
9197complete -c bun \
9292- -n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __fish_use_subcommand" -a dev -d 'Start dev server'
9898+ -n __fish_use_subcommand -a dev -d 'Start dev server'
9399complete -c bun \
9494- -n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a create -f -d 'Create a new project from a template'
100100+ -n __fish_use_subcommand -a create -f -d 'Create a new project from a template'
95101102102+# Complete "next" and "react" if we've seen "create".
96103complete -c bun \
9797- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create next react; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from create;" -a next -d 'new Next.js project'
104104+ -n "__fish_seen_subcommand_from create" -a next -d 'new Next.js project'
9810599106complete -c bun \
100100- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create next react; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from create;" -a react -d 'new React project'
107107+ -n "__fish_seen_subcommand_from create" -a react -d 'new React project'
101108109109+# Complete "upgrade" as first subcommand.
102110complete -c bun \
103103- -n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a upgrade -d 'Upgrade bun to the latest version' -x
111111+ -n __fish_use_subcommand -a upgrade -d 'Upgrade bun to the latest version' -x
112112+# Complete "-h/--help" unconditionally.
104113complete -c bun \
105105- -n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a --help -d 'See all commands and flags' -x
114114+ -s h -l help -d 'See all commands and flags' -x
106115116116+# Complete "-v/--version" if we have no subcommand.
107117complete -c bun \
108108- -n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -l version -s v -a --version -d 'Bun\'s version' -x
118118+ -n "not __fish_use_subcommand" -l version -s v -d 'Bun\'s version' -x
119119+120120+# Complete additional subcommands.
109121complete -c bun \
110110- -n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a discord -d 'Open bun\'s Discord server' -x
122122+ -n __fish_use_subcommand -a discord -d 'Open bun\'s Discord server' -x
111123112124113125complete -c bun \
114114- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_bun; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); __fish_use_subcommand" -a bun -d 'Generate a new bundle'
126126+ -n __fish_use_subcommand -a bun -d 'Generate a new bundle'
115127116128117129complete -c bun \
118118- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_bun; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from bun" -F -d 'Bundle this'
130130+ -n "__fish_seen_subcommand_from bun" -F -d 'Bundle this'
119131120132complete -c bun \
121121- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create; and not __fish_seen_subcommand_from (__fish__get_bun_bins); and not __fish_seen_subcommand_from (__fish__get_bun_scripts); and __fish_seen_subcommand_from react; or __fish_seen_subcommand_from next" -F -d "Create in directory"
133133+ -n "__fish_seen_subcommand_from create; and __fish_seen_subcommand_from react next" -F -d "Create in directory"
122134123135124136complete -c bun \
125125- -n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a init -F -d 'Start an empty Bun project'
137137+ -n __fish_use_subcommand -a init -F -d 'Start an empty Bun project'
126138127139complete -c bun \
128128- -n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a install -f -d 'Install packages from package.json'
140140+ -n __fish_use_subcommand -a install -f -d 'Install packages from package.json'
129141130142complete -c bun \
131131- -n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a add -F -d 'Add a package to package.json'
143143+ -n __fish_use_subcommand -a add -F -d 'Add a package to package.json'
132144133145complete -c bun \
134134- -n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a remove -F -d 'Remove a package from package.json'
135135-136136-complete -c bun \
137137- -n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand add remove" -F
146146+ -n __fish_use_subcommand -a remove -F -d 'Remove a package from package.json'
138147139148140149for i in (seq (count $bun_install_boolean_flags))
141150 complete -c bun \
142142- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l "$bun_install_boolean_flags[$i]" -d "$bun_install_boolean_flags_descriptions[$i]"
151151+ -n "__fish_seen_subcommand_from install add remove" -l "$bun_install_boolean_flags[$i]" -d "$bun_install_boolean_flags_descriptions[$i]"
143152end
144153145154complete -c bun \
146146- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l cwd -d 'Change working directory'
155155+ -n "__fish_seen_subcommand_from install add remove" -l cwd -d 'Change working directory'
147156148157complete -c bun \
149149- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l cache-dir -d 'Choose a cache directory (default: $HOME/.bun/install/cache)'
158158+ -n "__fish_seen_subcommand_from install add remove" -l cache-dir -d 'Choose a cache directory (default: $HOME/.bun/install/cache)'
150159151160complete -c bun \
152152- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from add;" -d Popular -a '(__fish__get_bun_packages)'
161161+ -n "__fish_seen_subcommand_from add" -d Popular -a '(__fish__get_bun_packages)'
153162154163complete -c bun \
155155- -n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from add;" -d History -a '(__history_completions)'
164164+ -n "__fish_seen_subcommand_from add" -d History -a '(__history_completions)'
156165157166complete -c bun \
158167 -n "__fish_seen_subcommand_from pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) cache;" -a 'bin ls cache hash hash-print hash-string' -f
···160169complete -c bun \
161170 -n "__fish_seen_subcommand_from pm; and __fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts);" -a rm -f
162171163163-complete -c bun -n "not __fish_seen_subcommand_from $bun_builtin_cmds (__fish__get_bun_bins) (__fish__get_bun_scripts)" -a "$bun_builtin_cmds" -f
172172+# Add built-in subcommands with descriptions.
173173+complete -c bun -n __fish_use_subcommand -a create -f -d "Create a new project from a template"
174174+complete -c bun -n __fish_use_subcommand -a "build bun" --require-parameter -F -d "Transpile and bundle one or more files"
175175+complete -c bun -n __fish_use_subcommand -a upgrade -d "Upgrade Bun"
176176+complete -c bun -n __fish_use_subcommand -a run -d "Run a script or package binary"
177177+complete -c bun -n __fish_use_subcommand -a install -d "Install dependencies from package.json" -f
178178+complete -c bun -n __fish_use_subcommand -a remove -d "Remove a dependency from package.json" -f
179179+complete -c bun -n __fish_use_subcommand -a add -d "Add a dependency to package.json" -f
180180+complete -c bun -n __fish_use_subcommand -a init -d "Initialize a Bun project in this directory" -f
181181+complete -c bun -n __fish_use_subcommand -a link -d "Register or link a local npm package" -f
182182+complete -c bun -n __fish_use_subcommand -a link -d "Unregister a local npm package" -f
183183+complete -c bun -n __fish_use_subcommand -a pm -d "Additional package management utilities" -f
184184+complete -c bun -n __fish_use_subcommand -a x -d "Execute a package binary, installing if needed" -f