# Fish completion for fpaste # Install: copy to ~/.config/fish/completions/fpaste.fish # Disable file completions by default complete -c fpaste -f # Helper function to check if command is specified function __fpaste_needs_command set -l cmd (commandline -opc) if test (count $cmd) -eq 1 return 0 end return 1 end function __fpaste_using_command set -l cmd (commandline -opc) if test (count $cmd) -gt 1 if test $argv[1] = $cmd[2] return 0 end end return 1 end function __fpaste_using_pki_command set -l cmd (commandline -opc) if test (count $cmd) -gt 2 if test $cmd[2] = 'pki' -a $argv[1] = $cmd[3] return 0 end end return 1 end # Global options complete -c fpaste -s s -l server -d 'Server URL' complete -c fpaste -s h -l help -d 'Show help' # Commands complete -c fpaste -n '__fpaste_needs_command' -a 'create' -d 'Create a new paste' complete -c fpaste -n '__fpaste_needs_command' -a 'c' -d 'Create a new paste' complete -c fpaste -n '__fpaste_needs_command' -a 'new' -d 'Create a new paste' complete -c fpaste -n '__fpaste_needs_command' -a 'get' -d 'Retrieve a paste' complete -c fpaste -n '__fpaste_needs_command' -a 'g' -d 'Retrieve a paste' complete -c fpaste -n '__fpaste_needs_command' -a 'delete' -d 'Delete paste(s)' complete -c fpaste -n '__fpaste_needs_command' -a 'd' -d 'Delete paste(s)' complete -c fpaste -n '__fpaste_needs_command' -a 'rm' -d 'Delete paste(s)' complete -c fpaste -n '__fpaste_needs_command' -a 'info' -d 'Show server info' complete -c fpaste -n '__fpaste_needs_command' -a 'i' -d 'Show server info' complete -c fpaste -n '__fpaste_needs_command' -a 'list' -d 'List your pastes' complete -c fpaste -n '__fpaste_needs_command' -a 'ls' -d 'List your pastes' complete -c fpaste -n '__fpaste_needs_command' -a 'search' -d 'Search your pastes' complete -c fpaste -n '__fpaste_needs_command' -a 's' -d 'Search your pastes' complete -c fpaste -n '__fpaste_needs_command' -a 'find' -d 'Search your pastes' complete -c fpaste -n '__fpaste_needs_command' -a 'update' -d 'Update existing paste' complete -c fpaste -n '__fpaste_needs_command' -a 'u' -d 'Update existing paste' complete -c fpaste -n '__fpaste_needs_command' -a 'export' -d 'Export all pastes' complete -c fpaste -n '__fpaste_needs_command' -a 'register' -d 'Register and get certificate' complete -c fpaste -n '__fpaste_needs_command' -a 'cert' -d 'Generate client certificate' complete -c fpaste -n '__fpaste_needs_command' -a 'pki' -d 'PKI operations' complete -c fpaste -n '__fpaste_needs_command' -a 'completion' -d 'Generate shell completion' # create command options complete -c fpaste -n '__fpaste_using_command create; or __fpaste_using_command c; or __fpaste_using_command new' -s E -l no-encrypt -d 'Disable encryption' complete -c fpaste -n '__fpaste_using_command create; or __fpaste_using_command c; or __fpaste_using_command new' -s b -l burn -d 'Burn after read' complete -c fpaste -n '__fpaste_using_command create; or __fpaste_using_command c; or __fpaste_using_command new' -s x -l expiry -d 'Expiry in seconds' -x complete -c fpaste -n '__fpaste_using_command create; or __fpaste_using_command c; or __fpaste_using_command new' -s p -l password -d 'Password protect' -x complete -c fpaste -n '__fpaste_using_command create; or __fpaste_using_command c; or __fpaste_using_command new' -s r -l raw -d 'Output raw URL' complete -c fpaste -n '__fpaste_using_command create; or __fpaste_using_command c; or __fpaste_using_command new' -s q -l quiet -d 'Output ID only' complete -c fpaste -n '__fpaste_using_command create; or __fpaste_using_command c; or __fpaste_using_command new' -s C -l clipboard -d 'Read from clipboard' complete -c fpaste -n '__fpaste_using_command create; or __fpaste_using_command c; or __fpaste_using_command new' -l copy-url -d 'Copy result URL to clipboard' complete -c fpaste -n '__fpaste_using_command create; or __fpaste_using_command c; or __fpaste_using_command new' -F # get command options complete -c fpaste -n '__fpaste_using_command get; or __fpaste_using_command g' -s o -l output -d 'Save to file' -r complete -c fpaste -n '__fpaste_using_command get; or __fpaste_using_command g' -s c -l copy -d 'Copy content to clipboard' complete -c fpaste -n '__fpaste_using_command get; or __fpaste_using_command g' -s p -l password -d 'Password' -x complete -c fpaste -n '__fpaste_using_command get; or __fpaste_using_command g' -s m -l meta -d 'Show metadata only' # delete command options complete -c fpaste -n '__fpaste_using_command delete; or __fpaste_using_command d; or __fpaste_using_command rm' -s a -l all -d 'Delete all pastes' complete -c fpaste -n '__fpaste_using_command delete; or __fpaste_using_command d; or __fpaste_using_command rm' -s c -l confirm -d 'Confirm count' -x # list command options complete -c fpaste -n '__fpaste_using_command list; or __fpaste_using_command ls' -s a -l all -d 'List all pastes (admin)' complete -c fpaste -n '__fpaste_using_command list; or __fpaste_using_command ls' -s l -l limit -d 'Max pastes' -x complete -c fpaste -n '__fpaste_using_command list; or __fpaste_using_command ls' -s o -l offset -d 'Skip first N pastes' -x complete -c fpaste -n '__fpaste_using_command list; or __fpaste_using_command ls' -l json -d 'Output as JSON' # search command options complete -c fpaste -n '__fpaste_using_command search; or __fpaste_using_command s; or __fpaste_using_command find' -s t -l type -d 'Filter by MIME type' -x complete -c fpaste -n '__fpaste_using_command search; or __fpaste_using_command s; or __fpaste_using_command find' -l after -d 'Created after' -x complete -c fpaste -n '__fpaste_using_command search; or __fpaste_using_command s; or __fpaste_using_command find' -l before -d 'Created before' -x complete -c fpaste -n '__fpaste_using_command search; or __fpaste_using_command s; or __fpaste_using_command find' -s l -l limit -d 'Max results' -x complete -c fpaste -n '__fpaste_using_command search; or __fpaste_using_command s; or __fpaste_using_command find' -l json -d 'Output as JSON' # update command options complete -c fpaste -n '__fpaste_using_command update; or __fpaste_using_command u' -s E -l no-encrypt -d 'Disable encryption' complete -c fpaste -n '__fpaste_using_command update; or __fpaste_using_command u' -s p -l password -d 'Set/change password' -x complete -c fpaste -n '__fpaste_using_command update; or __fpaste_using_command u' -l remove-password -d 'Remove password' complete -c fpaste -n '__fpaste_using_command update; or __fpaste_using_command u' -s x -l expiry -d 'Extend expiry' -x complete -c fpaste -n '__fpaste_using_command update; or __fpaste_using_command u' -s q -l quiet -d 'Minimal output' complete -c fpaste -n '__fpaste_using_command update; or __fpaste_using_command u' -F # export command options complete -c fpaste -n '__fpaste_using_command export' -s o -l output -d 'Output directory' -r complete -c fpaste -n '__fpaste_using_command export' -s k -l keyfile -d 'Key file' -r complete -c fpaste -n '__fpaste_using_command export' -l manifest -d 'Write manifest.json' complete -c fpaste -n '__fpaste_using_command export' -s q -l quiet -d 'Minimal output' # register command options complete -c fpaste -n '__fpaste_using_command register' -s n -l name -d 'Common name' -x complete -c fpaste -n '__fpaste_using_command register' -s o -l output -d 'Output directory' -r complete -c fpaste -n '__fpaste_using_command register' -l configure -d 'Update config file' complete -c fpaste -n '__fpaste_using_command register' -l p12-only -d 'Save only PKCS#12' complete -c fpaste -n '__fpaste_using_command register' -s f -l force -d 'Overwrite existing files' complete -c fpaste -n '__fpaste_using_command register' -s q -l quiet -d 'Minimal output' # cert command options complete -c fpaste -n '__fpaste_using_command cert' -s o -l output -d 'Output directory' -r complete -c fpaste -n '__fpaste_using_command cert' -s a -l algorithm -d 'Key algorithm' -x -a 'rsa ec' complete -c fpaste -n '__fpaste_using_command cert' -s b -l bits -d 'RSA key size' -x complete -c fpaste -n '__fpaste_using_command cert' -s c -l curve -d 'EC curve' -x -a 'secp256r1 secp384r1 secp521r1' complete -c fpaste -n '__fpaste_using_command cert' -s d -l days -d 'Validity period' -x complete -c fpaste -n '__fpaste_using_command cert' -s n -l name -d 'Common name' -x complete -c fpaste -n '__fpaste_using_command cert' -l password-key -d 'Encrypt private key' -x complete -c fpaste -n '__fpaste_using_command cert' -l configure -d 'Update config file' complete -c fpaste -n '__fpaste_using_command cert' -s f -l force -d 'Overwrite existing files' # pki subcommands complete -c fpaste -n '__fpaste_using_command pki' -a 'status' -d 'Show PKI status' complete -c fpaste -n '__fpaste_using_command pki' -a 'issue' -d 'Request certificate from server' complete -c fpaste -n '__fpaste_using_command pki' -a 'download' -d 'Download CA certificate' complete -c fpaste -n '__fpaste_using_command pki' -a 'dl' -d 'Download CA certificate' # pki issue options complete -c fpaste -n '__fpaste_using_pki_command issue' -s n -l name -d 'Common name' -x complete -c fpaste -n '__fpaste_using_pki_command issue' -s o -l output -d 'Output directory' -r complete -c fpaste -n '__fpaste_using_pki_command issue' -l configure -d 'Update config file' complete -c fpaste -n '__fpaste_using_pki_command issue' -s f -l force -d 'Overwrite existing files' # pki download options complete -c fpaste -n '__fpaste_using_pki_command download; or __fpaste_using_pki_command dl' -s o -l output -d 'Save to file' -r complete -c fpaste -n '__fpaste_using_pki_command download; or __fpaste_using_pki_command dl' -l configure -d 'Update config file' # completion command options complete -c fpaste -n '__fpaste_using_command completion' -l shell -d 'Shell type' -x -a 'bash zsh fish'