#compdef gpaste

if (( CURRENT == 2 )); then

    local commands

    commands=(
        {add,a}:"Set text to clipboard"
        {add-password,ap}:"Add a name - password couple to the clipboard"
        {about}:"Display the about dialog"
        {backup-history,bh}:"Backup current history"
        {daemon-reexec,dr}:"Reexecute the daemon"
        {daemon-version,dv}:"Display the daemon version"
        {delete,del,d,remove,rm}:"Delete an element of the history"
        {delete-history,dh}:"Delete a history"
        {delete-password,dp}:"Delete a password"
        {empty,e}:"Empty the history"
        {file,f}:"Put content of file into clipboard"
        {get,g}:"Display an element of the history"
        {get-raw,gr}:"Display an element of the history (raw)"
        {help,--help,-h}:"Display the help"
        {history,h}:"Display the history with indexes"
        {history-size,hs}:"Display the size of the history"
        {list-histories,lh}:"List available histories"
        {oneline,oh}:"Display the history without newlines"
        {raw-history,rh}:"Display the history (raw) without indexes"
        {rename-password,rp}:"Rename a password"
        {select,set,s}:"Select an element of the history"
        {set-password,sp}:"Mark an item as being a password"
        {settings,s,preferences,p}:"Launch the configuration tool"
        {start,daemon,d}:"Start the daemon"
        {stop,quit,q}:"Shutdown the daemon"
        {show-history}:"Make the applet or extension display the history"
        {switch-history,sh}:"Switch to another history"
        {version,v,--version,-v}:"Display the version"
        {zero-history,zh}:"Display the history with NUL as separator"
    )

    _describe -t commands command commands

else if  (( CURRENT == 3 ))

    case "${words[2]}" in
        "file"|"f")
            _arguments -s : '*: :_files'
    esac

fi
