2024-05-14 20:29:40 -07:00
use builtin;
use str;
set edit:completion:arg-completer[just] = {|@words|
fn spaces {|n|
builtin:repeat $n ' ' | str:join ''
2020-01-15 01:20:38 -08:00
}
2024-05-14 20:29:40 -07:00
fn cand {|text desc|
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
2020-01-15 01:20:38 -08:00
}
2024-05-14 20:29:40 -07:00
var command = 'just'
for word $words[1..-1] {
if (str:has-prefix $word '-') {
2020-01-15 01:20:38 -08:00
break
}
2024-05-14 20:29:40 -07:00
set command = $command';'$word
2020-01-15 01:20:38 -08:00
}
2024-05-14 20:29:40 -07:00
var completions = [
2020-01-15 01:20:38 -08:00
&'just'= {
2020-09-17 19:43:04 -07:00
cand --chooser 'Override binary invoked by `--choose`'
2020-01-15 01:20:38 -08:00
cand --color 'Print colorful output'
2023-10-10 17:04:34 -07:00
cand --command-color 'Echo recipe lines in <COMMAND-COLOR>'
2021-11-17 00:07:48 -08:00
cand --dump-format 'Dump justfile as <FORMAT>'
2021-02-09 01:00:04 -08:00
cand --list-heading 'Print <TEXT> before list'
cand --list-prefix 'Print <TEXT> before each list item'
cand -f 'Use <JUSTFILE> as justfile'
cand --justfile 'Use <JUSTFILE> as justfile'
2020-01-15 01:20:38 -08:00
cand --set 'Override <VARIABLE> with <VALUE>'
cand --shell 'Invoke <SHELL> to run recipes'
cand --shell-arg 'Invoke shell with <SHELL-ARG> as an argument'
cand -d 'Use <WORKING-DIRECTORY> as working directory. --justfile must also be set'
cand --working-directory 'Use <WORKING-DIRECTORY> as working directory. --justfile must also be set'
2021-05-09 20:35:35 -07:00
cand -c 'Run an arbitrary command with the working directory, `.env`, overrides, and exports set'
cand --command 'Run an arbitrary command with the working directory, `.env`, overrides, and exports set'
2020-01-15 01:20:38 -08:00
cand --completions 'Print shell completion script for <SHELL>'
cand -s 'Show information about <RECIPE>'
cand --show 'Show information about <RECIPE>'
2021-08-08 22:37:35 -07:00
cand --dotenv-filename 'Search for environment file named <DOTENV-FILENAME> instead of `.env`'
2024-03-19 10:50:34 -07:00
cand -E 'Load <DOTENV-PATH> as environment file instead of searching for one'
cand --dotenv-path 'Load <DOTENV-PATH> as environment file instead of searching for one'
2021-10-31 21:27:59 -07:00
cand --check 'Run `--fmt` in ''check'' mode. Exits with 0 if justfile is formatted correctly. Exits with 1 and prints a diff if formatting is required.'
2023-11-16 15:51:34 -08:00
cand --yes 'Automatically confirm all recipes.'
2023-01-23 23:48:30 -08:00
cand -n 'Print what just would do without doing it'
2020-01-15 01:20:38 -08:00
cand --dry-run 'Print what just would do without doing it'
cand --highlight 'Highlight echoed recipe lines in bold'
2024-03-26 12:20:46 -07:00
cand --no-aliases 'Don''t show aliases in list'
2024-01-09 00:40:08 -08:00
cand --no-deps 'Don''t run recipe dependencies'
2020-05-23 20:41:12 -07:00
cand --no-dotenv 'Don''t load `.env` file'
2020-01-15 01:20:38 -08:00
cand --no-highlight 'Don''t highlight echoed recipe lines in bold'
cand -q 'Suppress all output'
cand --quiet 'Suppress all output'
2021-05-09 20:35:35 -07:00
cand --shell-command 'Invoke <COMMAND> with the shell used to run recipe lines and backticks'
2020-01-15 01:20:38 -08:00
cand --clear-shell-args 'Clear shell arguments'
2020-08-21 15:13:54 -07:00
cand -u 'Return list and summary entries in source order'
cand --unsorted 'Return list and summary entries in source order'
2021-06-12 15:34:41 -07:00
cand --unstable 'Enable unstable features'
2020-01-15 01:20:38 -08:00
cand -v 'Use verbose output'
cand --verbose 'Use verbose output'
2021-07-31 13:53:27 -07:00
cand --changelog 'Print changelog'
2023-12-13 16:48:40 -08:00
cand --choose 'Select one or more recipes to run using a binary chooser. If `--chooser` is not passed the chooser defaults to the value of $JUST_CHOOSER, falling back to `fzf`'
2021-11-17 00:07:48 -08:00
cand --dump 'Print justfile'
2020-01-15 01:20:38 -08:00
cand -e 'Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`'
cand --edit 'Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`'
2021-04-25 17:25:34 -07:00
cand --evaluate 'Evaluate and print all variables. If a variable name is given as an argument, only print that variable''s value.'
2021-06-08 01:01:27 -07:00
cand --fmt 'Format and overwrite justfile'
2020-01-15 01:20:38 -08:00
cand --init 'Initialize new justfile in project root'
cand -l 'List available recipes and their arguments'
cand --list 'List available recipes and their arguments'
2024-05-15 00:28:50 -07:00
cand --man 'Print man page'
2020-01-15 01:20:38 -08:00
cand --summary 'List names of available recipes'
2020-03-13 22:19:43 -07:00
cand --variables 'List names of variables'
2024-05-19 02:29:13 -07:00
cand -g 'Use global justfile'
cand --global-justfile 'Use global justfile'
2024-05-14 20:29:40 -07:00
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
2020-01-15 01:20:38 -08:00
}
]
$completions[$command]
}