From 3c8ab1bd24b96ca9db1683c88b1fbb2ce52f49eb Mon Sep 17 00:00:00 2001 From: Brad Clawsie Date: Fri, 18 Oct 2024 03:49:53 -0500 Subject: add git stuff --- fish/completions/just.fish | 90 ++++++++++++++++++++++++++++++++++++++++++++++ fish/config.fish | 2 ++ 2 files changed, 92 insertions(+) create mode 100644 fish/completions/just.fish (limited to 'fish') diff --git a/fish/completions/just.fish b/fish/completions/just.fish new file mode 100644 index 0000000..d6dee33 --- /dev/null +++ b/fish/completions/just.fish @@ -0,0 +1,90 @@ +function __fish_just_complete_recipes + if string match -rq '(-f|--justfile)\s*=?(?[^\s]+)' -- (string split -- ' -- ' (commandline -pc))[1] + set -fx JUST_JUSTFILE "$justfile" + end + just --list 2> /dev/null | tail -n +2 | awk '{ + command = $1; + args = $0; + desc = ""; + delim = ""; + sub(/^[[:space:]]*[^[:space:]]*/, "", args); + gsub(/^[[:space:]]+|[[:space:]]+$/, "", args); + + if (match(args, /#.*/)) { + desc = substr(args, RSTART+2, RLENGTH); + args = substr(args, 0, RSTART-1); + gsub(/^[[:space:]]+|[[:space:]]+$/, "", args); + } + + gsub(/\+|=[`\'"][^`\'"]*[`\'"]/, "", args); + gsub(/ /, ",", args); + + if (args != ""){ + args = "Args: " args; + } + + if (args != "" && desc != "") { + delim = "; "; + } + + print command "\t" args delim desc + }' +end + +# don't suggest files right off +complete -c just -n "__fish_is_first_arg" --no-files + +# complete recipes +complete -c just -a '(__fish_just_complete_recipes)' + +# autogenerated completions +complete -c just -l chooser -d 'Override binary invoked by `--choose`' -r +complete -c just -l color -d 'Print colorful output' -r -f -a "{auto\t'',always\t'',never\t''}" +complete -c just -l command-color -d 'Echo recipe lines in ' -r -f -a "{black\t'',blue\t'',cyan\t'',green\t'',purple\t'',red\t'',yellow\t''}" +complete -c just -l dotenv-filename -d 'Search for environment file named instead of `.env`' -r +complete -c just -s E -l dotenv-path -d 'Load as environment file instead of searching for one' -r -F +complete -c just -l dump-format -d 'Dump justfile as ' -r -f -a "{json\t'',just\t''}" +complete -c just -s f -l justfile -d 'Use as justfile' -r -F +complete -c just -l list-heading -d 'Print before list' -r +complete -c just -l list-prefix -d 'Print before each list item' -r +complete -c just -l set -d 'Override with ' -r +complete -c just -l shell -d 'Invoke to run recipes' -r +complete -c just -l shell-arg -d 'Invoke shell with as an argument' -r +complete -c just -l timestamp-format -d 'Timestamp format string' -r +complete -c just -s d -l working-directory -d 'Use as working directory. --justfile must also be set' -r -F +complete -c just -s c -l command -d 'Run an arbitrary command with the working directory, `.env`, overrides, and exports set' -r +complete -c just -l completions -d 'Print shell completion script for ' -r -f -a "{bash\t'',elvish\t'',fish\t'',nushell\t'',powershell\t'',zsh\t''}" +complete -c just -s l -l list -d 'List available recipes' -r +complete -c just -s s -l show -d 'Show recipe at ' -r +complete -c just -l check -d 'Run `--fmt` in \'check\' mode. Exits with 0 if justfile is formatted correctly. Exits with 1 and prints a diff if formatting is required.' +complete -c just -l clear-shell-args -d 'Clear shell arguments' +complete -c just -s n -l dry-run -d 'Print what just would do without doing it' +complete -c just -l explain -d 'Print recipe doc comment before running it' +complete -c just -s g -l global-justfile -d 'Use global justfile' +complete -c just -l highlight -d 'Highlight echoed recipe lines in bold' +complete -c just -l list-submodules -d 'List recipes in submodules' +complete -c just -l no-aliases -d 'Don\'t show aliases in list' +complete -c just -l no-deps -d 'Don\'t run recipe dependencies' +complete -c just -l no-dotenv -d 'Don\'t load `.env` file' +complete -c just -l no-highlight -d 'Don\'t highlight echoed recipe lines in bold' +complete -c just -l one -d 'Forbid multiple recipes from being invoked on the command line' +complete -c just -s q -l quiet -d 'Suppress all output' +complete -c just -l shell-command -d 'Invoke with the shell used to run recipe lines and backticks' +complete -c just -l timestamp -d 'Print recipe command timestamps' +complete -c just -s u -l unsorted -d 'Return list and summary entries in source order' +complete -c just -l unstable -d 'Enable unstable features' +complete -c just -s v -l verbose -d 'Use verbose output' +complete -c just -l yes -d 'Automatically confirm all recipes.' +complete -c just -l changelog -d 'Print changelog' +complete -c just -l choose -d '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`' +complete -c just -l dump -d 'Print justfile' +complete -c just -s e -l edit -d 'Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`' +complete -c just -l evaluate -d 'Evaluate and print all variables. If a variable name is given as an argument, only print that variable\'s value.' +complete -c just -l fmt -d 'Format and overwrite justfile' +complete -c just -l groups -d 'List recipe groups' +complete -c just -l init -d 'Initialize new justfile in project root' +complete -c just -l man -d 'Print man page' +complete -c just -l summary -d 'List names of available recipes' +complete -c just -l variables -d 'List names of variables' +complete -c just -s h -l help -d 'Print help' +complete -c just -s V -l version -d 'Print version' diff --git a/fish/config.fish b/fish/config.fish index 227e739..6c55df8 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,6 +1,8 @@ alias c="clear" alias h="history" alias gpg-agent-restart="gpg-connect-agent reloadagent /bye" +alias gl="git log --graph --pretty=\"tformat:%C(always,yellow)%h%C(always,reset) %C(always,green)%ar%C(always,reset){%C(always,bold blue)%an%C(always,reset){%C(always,red)%d%C(always,reset) %s\" | column -t -s '{' | less -XRS --quit-if-one-screen" +alias remove-untracked-files="git ls-files --other --exclude-standard | xargs rm -rf" if status is-interactive set -gx LANG en_US.UTF-8 -- cgit v1.2.3