|
| 1 | +use builtin; |
| 2 | +use str; |
| 3 | + |
| 4 | +set edit:completion:arg-completer[just] = {|@words| |
| 5 | + fn spaces {|n| |
| 6 | + builtin:repeat $n ' ' | str:join '' |
| 7 | + } |
| 8 | + fn cand {|text desc| |
| 9 | + edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc |
| 10 | + } |
| 11 | + var command = 'just' |
| 12 | + for word $words[1..-1] { |
| 13 | + if (str:has-prefix $word '-') { |
| 14 | + break |
| 15 | + } |
| 16 | + set command = $command';'$word |
| 17 | + } |
| 18 | + var completions = [ |
| 19 | + &'just'= { |
| 20 | + cand --alias-style 'Set list command alias display style' |
| 21 | + cand --ceiling 'Do not ascend above <CEILING> directory when searching for a justfile.' |
| 22 | + cand --chooser 'Override binary invoked by `--choose`' |
| 23 | + cand --color 'Print colorful output' |
| 24 | + cand --command-color 'Echo recipe lines in <COMMAND-COLOR>' |
| 25 | + cand --cygpath 'Use binary at <CYGPATH> to convert between unix and Windows paths.' |
| 26 | + cand --dotenv-filename 'Search for environment file named <DOTENV-FILENAME> instead of `.env`' |
| 27 | + cand -E 'Load <DOTENV-PATH> as environment file instead of searching for one' |
| 28 | + cand --dotenv-path 'Load <DOTENV-PATH> as environment file instead of searching for one' |
| 29 | + cand --dump-format 'Dump justfile as <FORMAT>' |
| 30 | + cand -f 'Use <JUSTFILE> as justfile' |
| 31 | + cand --justfile 'Use <JUSTFILE> as justfile' |
| 32 | + cand --list-heading 'Print <TEXT> before list' |
| 33 | + cand --list-prefix 'Print <TEXT> before each list item' |
| 34 | + cand --set 'Override <VARIABLE> with <VALUE>' |
| 35 | + cand --shell 'Invoke <SHELL> to run recipes' |
| 36 | + cand --shell-arg 'Invoke shell with <SHELL-ARG> as an argument' |
| 37 | + cand --tempdir 'Save temporary files to <TEMPDIR>.' |
| 38 | + cand --timestamp-format 'Timestamp format string' |
| 39 | + cand -d 'Use <WORKING-DIRECTORY> as working directory. --justfile must also be set' |
| 40 | + cand --working-directory 'Use <WORKING-DIRECTORY> as working directory. --justfile must also be set' |
| 41 | + cand -c 'Run an arbitrary command with the working directory, `.env`, overrides, and exports set' |
| 42 | + cand --command 'Run an arbitrary command with the working directory, `.env`, overrides, and exports set' |
| 43 | + cand --completions 'Print shell completion script for <SHELL>' |
| 44 | + cand -l 'List available recipes in <MODULE> or root if omitted' |
| 45 | + cand --list 'List available recipes in <MODULE> or root if omitted' |
| 46 | + cand --request 'Execute <REQUEST>. For internal testing purposes only. May be changed or removed at any time.' |
| 47 | + cand -s 'Show recipe at <PATH>' |
| 48 | + cand --show 'Show recipe at <PATH>' |
| 49 | + 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.' |
| 50 | + cand --clear-shell-args 'Clear shell arguments' |
| 51 | + cand -n 'Print what just would do without doing it' |
| 52 | + cand --dry-run 'Print what just would do without doing it' |
| 53 | + cand --explain 'Print recipe doc comment before running it' |
| 54 | + cand -g 'Use global justfile' |
| 55 | + cand --global-justfile 'Use global justfile' |
| 56 | + cand --highlight 'Highlight echoed recipe lines in bold' |
| 57 | + cand --list-submodules 'List recipes in submodules' |
| 58 | + cand --no-aliases 'Don''t show aliases in list' |
| 59 | + cand --no-deps 'Don''t run recipe dependencies' |
| 60 | + cand --no-dotenv 'Don''t load `.env` file' |
| 61 | + cand --no-highlight 'Don''t highlight echoed recipe lines in bold' |
| 62 | + cand --one 'Forbid multiple recipes from being invoked on the command line' |
| 63 | + cand -q 'Suppress all output' |
| 64 | + cand --quiet 'Suppress all output' |
| 65 | + cand --allow-missing 'Ignore missing recipe and module errors' |
| 66 | + cand --shell-command 'Invoke <COMMAND> with the shell used to run recipe lines and backticks' |
| 67 | + cand --timestamp 'Print recipe command timestamps' |
| 68 | + cand -u 'Return list and summary entries in source order' |
| 69 | + cand --unsorted 'Return list and summary entries in source order' |
| 70 | + cand --unstable 'Enable unstable features' |
| 71 | + cand -v 'Use verbose output' |
| 72 | + cand --verbose 'Use verbose output' |
| 73 | + cand --yes 'Automatically confirm all recipes.' |
| 74 | + cand --changelog 'Print changelog' |
| 75 | + 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`' |
| 76 | + cand --dump 'Print justfile' |
| 77 | + cand -e 'Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`' |
| 78 | + cand --edit 'Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`' |
| 79 | + cand --evaluate 'Evaluate and print all variables. If a variable name is given as an argument, only print that variable''s value.' |
| 80 | + cand --fmt 'Format and overwrite justfile' |
| 81 | + cand --groups 'List recipe groups' |
| 82 | + cand --init 'Initialize new justfile in project root' |
| 83 | + cand --man 'Print man page' |
| 84 | + cand --summary 'List names of available recipes' |
| 85 | + cand --variables 'List names of variables' |
| 86 | + cand -h 'Print help' |
| 87 | + cand --help 'Print help' |
| 88 | + cand -V 'Print version' |
| 89 | + cand --version 'Print version' |
| 90 | + } |
| 91 | + ] |
| 92 | + $completions[$command] |
| 93 | +} |
0 commit comments