fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
31b15405e
master
1# Completion for builtin path 2# This follows a strict command-then-options approach, so we can just test the number of tokens 3complete -f -c path -n"test (count (commandline -xpc)) -le 2" -s h -l help -d"Display help and exit" 4complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a basename -d'Give basename for given paths' 5complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a dirname -d'Give dirname for given paths' 6complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a extension -d'Give extension for given paths' 7complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a change-extension -d'Change extension for given paths' 8complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a mtime -d'Show modification time' 9complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a normalize -d'Normalize given paths (remove ./, resolve ../ against other components..)' 10complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a resolve -d'Normalize given paths and resolve symlinks' 11complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a filter -d'Print paths that match a filter' 12complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a is -d'Return true if any path matched a filter' 13complete -f -c path -n"test (count (commandline -xpc)) -lt 2" -a sort -d'Sort paths' 14complete -f -c path -n"test (count (commandline -xpc)) -ge 2" -s q -l quiet -d"Only return status, no output" 15complete -f -c path -n"test (count (commandline -xpc)) -ge 2" -s z -l null-in -d"Handle NULL-delimited input" 16complete -f -c path -n"test (count (commandline -xpc)) -ge 2" -s Z -l null-out -d"Print NULL-delimited output" 17complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] basename" -s E -l no-extension -d"Remove the extension" 18complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] filter is" -s v -l invert -d"Invert meaning of filters" 19complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] filter is" -s t -l type -d"Filter by type" -x -a'(__fish_append , file link dir block char fifo socket)' 20complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] filter is" -s f -d"Filter files" 21complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] filter is" -s d -d"Filter directories" 22complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] filter is" -s l -d"Filter symlinks" 23complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] filter is" -s p -l perm -d"Filter by permission" -x -a'(__fish_append , read write exec suid sgid user group)' 24complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] filter is" -s r -d"Filter readable paths" 25complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] filter is" -s w -d"Filter writable paths" 26complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] filter is" -s x -d"Filter executable paths" 27complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] mtime" -s R -l relative -d"Show seconds since the modification time" 28complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] sort" \ 29 -l key -x -a'basename\t"Sort only by basename" dirname\t"Sort only by dirname" path\t"Sort by full path"' 30complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] sort" -s u -l unique -d'Only leave the first of each run with the same key' 31complete -f -c path -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] sort" -s r -l reverse -d'Reverse the order' 32 33# Turn on file completions again. 34# match takes a glob as first arg, expand takes only globs. 35# We still want files completed then! 36complete -F -c path -n"test (count (commandline -xpc)) -ge 2"