| 1 |
#compdef gpaste-client |
| 2 |
|
| 3 |
(( $+functions[_gpaste-client_complete_arguments] )) || |
| 4 |
_gpaste-client_complete_arguments() { |
| 5 |
local -a base_arguments file_arguments get_arguments history_arguments |
| 6 |
|
| 7 |
base_arguments=( |
| 8 |
'(-h --help)'{-h,--help}'[Display the help.]' |
| 9 |
'(-v --version)'{-v,--version}'[Display the version.]' |
| 10 |
) |
| 11 |
|
| 12 |
file_arguments=( |
| 13 |
'*:file:_files' |
| 14 |
) |
| 15 |
|
| 16 |
get_arguments=( |
| 17 |
'(-r --raw)'{-r,--raw}'[Display the raw item, not the display string.]' |
| 18 |
) |
| 19 |
|
| 20 |
history_arguments=( |
| 21 |
'(-o --oneline)'{-o,--oneline}'[Display each item on one line.]' |
| 22 |
'(-e --reverse)'{-e,--reverse}'[Display the items in reverse order.]' |
| 23 |
'(-r --raw)'{-r,--raw}'[Display each item raw (without index).]' |
| 24 |
'(-z --zero)'{-z,--zero}'[Use a NUL character instead of a newline between each item.]' |
| 25 |
) |
| 26 |
|
| 27 |
merge_arguments=( |
| 28 |
'(-d --decoration)'{-d,--decoration}'[Add the decoration at the beginning and end of each item before merging.]' |
| 29 |
'(-s --separator)'{-s,--separator}'[Add a separator between each item when merging.]' |
| 30 |
) |
| 31 |
|
| 32 |
case "${1}" in |
| 33 |
base) |
| 34 |
_arguments -s : \ |
| 35 |
${base_arguments} ${history_arguments} |
| 36 |
;; |
| 37 |
file|f) |
| 38 |
_arguments -s : \ |
| 39 |
${file_arguments} |
| 40 |
;; |
| 41 |
get|g) |
| 42 |
_arguments -s : \ |
| 43 |
${get_arguments} |
| 44 |
;; |
| 45 |
history|h) |
| 46 |
_arguments -s : \ |
| 47 |
${history_arguments} |
| 48 |
;; |
| 49 |
merge|m) |
| 50 |
_arguments -s : \ |
| 51 |
${merge_arguments} |
| 52 |
;; |
| 53 |
esac |
| 54 |
} |
| 55 |
|
| 56 |
(( $+functions[_gpaste-client_complete_subcommands] )) || |
| 57 |
_gpaste-client_complete_subcommands() { |
| 58 |
local -a subcommands |
| 59 |
subcommands=( |
| 60 |
{add,a}:"Set text to clipboard" |
| 61 |
{add-password,ap}:"Add a name - password couple to the clipboard" |
| 62 |
"about:Display the about dialog" |
| 63 |
{backup-history,bh}:"Backup current history" |
| 64 |
{daemon-reexec,dr}:"Reexecute the daemon" |
| 65 |
{daemon-version,dv}:"Display the daemon version" |
| 66 |
{delete,del,d,remove,rm}:"Delete an element of the history" |
| 67 |
{delete-history,dh}:"Delete a history" |
| 68 |
{delete-password,dp}:"Delete a password" |
| 69 |
{empty,e}:"Empty the history" |
| 70 |
{file,f}:"Put content of file into clipboard" |
| 71 |
{get,g}:"Display an element of the history" |
| 72 |
{get-history,gh}:"Get the name of the current history" |
| 73 |
"help:Display the help" |
| 74 |
{history,h}:"Display the history with indexes" |
| 75 |
{history-size,hs}:"Display the size of the history" |
| 76 |
{list-histories,lh}:"List available histories" |
| 77 |
{merge,m}:"Merge various elements from history" |
| 78 |
{rename-password,rp}:"Rename a password" |
| 79 |
"replace:Replace the contents of an item" |
| 80 |
{select,set,s}:"Select an element of the history" |
| 81 |
{set-password,sp}:"Mark an item as being a password" |
| 82 |
{settings,preferences,p}:"Launch the configuration tool" |
| 83 |
{start,daemon,d}:"Start the daemon" |
| 84 |
{stop,quit,q}:"Shutdown the daemon" |
| 85 |
"show-history:Make the applet or extension display the history" |
| 86 |
{switch-history,sh}:"Switch to another history" |
| 87 |
"ui:Launch the graphical tool" |
| 88 |
{upload,u}:"Upload item to a pastebin service" |
| 89 |
{version,v}:"Display the version" |
| 90 |
{zero-history,zh}:"Display the history with NUL as separator" |
| 91 |
) |
| 92 |
|
| 93 |
_describe -t commands 'gpaste-client subcommand' subcommands |
| 94 |
_gpaste-client_complete_arguments "base" |
| 95 |
} |
| 96 |
|
| 97 |
_gpaste-client() { |
| 98 |
if (( CURRENT > 2 )); then |
| 99 |
local cmd="${words[2]}" |
| 100 |
local ctx="gpaste-client" |
| 101 |
while (( CURRENT > 2 )); do |
| 102 |
ctx="${ctx}-${words[2]}" |
| 103 |
(( CURRENT-- )) |
| 104 |
shift words |
| 105 |
done |
| 106 |
curcontext="${curcontext%:*:*}:${ctx}" |
| 107 |
_gpaste-client_complete_arguments "${cmd}" |
| 108 |
else |
| 109 |
_gpaste-client_complete_subcommands |
| 110 |
fi |
| 111 |
} |
| 112 |
|
| 113 |
_gpaste-client "${@}" |