fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
7360deee7
master
1# apple shortcuts.app CLI tool completion sucker downer by Aaron Gyes 2# https://en.wikipedia.org/wiki/Shortcuts_(app) 3 4# Apple added fish completion output to Swift's ArgumentParser. 5# imagine my surprise when I found fish function strings in binaries in /usr/bin! 6 7# checking the path is as expected is about as far as we're going with validation 8if test "$ ( command -s shortcuts ) " = /usr/bin/shortcuts 9command shortcuts --generate-completion-script=fish| source 10end 11 12# output is like: 13 14# function __fish_shortcuts_using_command 15# set cmd (commandline -xpc) 16# if test (count $cmd) -eq (count $argv) 17# for i in (seq (count $argv)) 18# if test $cmd[$i] != $argv[$i] 19# return 1 20# end 21# end 22# return 0 23# end 24# return 1 25# end 26# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts' -f -a 'run' -d 'Run a shortcut.' 27# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts' -f -a 'list' -d 'List your shortcuts.' 28# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts' -f -a 'view' -d 'View a shortcut in Shortcuts.' 29# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts' -f -a 'sign' -d 'Sign a shortcut file.' 30# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts' -f -a 'help' -d 'Show subcommand help information.' 31# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts run' -f -r -s i -l input-path -d 'The input to provide to the shortcut.' 32# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts run -i' -f -a '(for i in *.{}; echo $i;end)' 33# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts run --input-path' -f -a '(for i in *.{}; echo $i;end)' 34# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts run' -f -r -s o -l output-path -d 'Where to write the shortcut output, if applicable.' 35# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts run -o' -f -a '(for i in *.{}; echo $i;end)' 36# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts run --output-path' -f -a '(for i in *.{}; echo $i;end)' 37# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts run' -f -r -l output-type -d 'What type to output data in, in Universal Type Identifier format.' 38# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts list' -f -r -s f -l folder-name -d 'The folder to list.' 39# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts list -f' -f -a '(command shortcuts ---completion list -- --custom (commandline -xpc)[1..-1])' 40# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts list --folder-name' -f -a '(command shortcuts ---completion list -- --custom (commandline -xpc)[1..-1])' 41# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts list' -f -l folders -d 'List folders instead of shortcuts.' 42# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts sign' -f -r -s m -l mode -d 'The signing mode.' 43# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts sign' -f -r -s i -l input -d 'The shortcut file to sign.' 44# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts sign -i' -f -a '(for i in *.{shortcut}; echo $i;end)' 45# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts sign --input' -f -a '(for i in *.{shortcut}; echo $i;end)' 46# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts sign' -f -r -s o -l output -d 'Output path for the signed shortcut file.' 47# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts sign -o' -f -a '(for i in *.{shortcut,wflow}; echo $i;end)' 48# complete -c shortcuts -n '__fish_shortcuts_using_command shortcuts sign --output' -f -a '(for i in *.{shortcut,wflow}; echo $i;end)'