From 3acd0dfe486c77fd033f9152334b8491a9f6989a Mon Sep 17 00:00:00 2001 From: Maxim Gonchar Date: Sun, 6 Jul 2014 20:40:53 +0800 Subject: Add dropbox completion --- share/completions/dropbox.fish | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 share/completions/dropbox.fish (limited to 'share/completions') diff --git a/share/completions/dropbox.fish b/share/completions/dropbox.fish new file mode 100644 index 00000000..02dfb90a --- /dev/null +++ b/share/completions/dropbox.fish @@ -0,0 +1,39 @@ + +function __dropbox_needs_argument + set -l cmd (commandline -opc) + if set -q cmd[2] + switch "$cmd[2]" + case '-*' + case '*' + return 1 + end + end +end + +complete -c dropbox -x +complete -c dropbox -n __dropbox_needs_argument -a status -d "Get current status of the dropboxd" +complete -c dropbox -n __dropbox_needs_argument -a help -d "Provide help" +complete -c dropbox -n __dropbox_needs_argument -a running -d "Return 1 if dropbox is running" +complete -c dropbox -n __dropbox_needs_argument -a autostart -d "Ubuntu: automatically start dropbox at login" +complete -c dropbox -n "__dropbox_needs_argument; and dropbox running" -a start -d "Start dropboxd" +complete -c dropbox -n "__dropbox_needs_argument; and not dropbox running" -a puburl -d "Get public url of a file in your dropbox" +complete -c dropbox -n "__dropbox_needs_argument; and not dropbox running" -a stop -d "Stop dropboxd" +complete -c dropbox -n "__dropbox_needs_argument; and not dropbox running" -a 'stat filestatus' -d "Get current sync status of one or more files" +complete -c dropbox -n "__dropbox_needs_argument; and not dropbox running" -a ls -d "List directory contents with current sync status" +complete -c dropbox -n "__dropbox_needs_argument; and not dropbox running" -a exclude -d "Ignores/excludes a directory from syncing" +complete -c dropbox -n "__dropbox_needs_argument; and not dropbox running" -a lansync -d "Enables or disables LAN sync" + +set -l subcommands help puburl stop running start file status ls autostart exclude lansync stat +complete -c dropbox -n "__fish_seen_subcommand_from help" -xa "$subcommands" +complete -c dropbox -n "__fish_seen_subcommand_from start" -s i -l install -d "Auto install dropboxd if not available on the system" +complete -c dropbox -n "__fish_seen_subcommand_from filestatus stat" -s l -l list -d "Prints out information in a format similar to ls. works best when your console supports color :)" +complete -c dropbox -n "__fish_seen_subcommand_from filestatus stat ls" -s a -l all -d "Do not ignore entries starting with ." +complete -c dropbox -n "__fish_seen_subcommand_from autostart lansync" -xa '(echo -e "y\tEnable\nn\tDisable")' + +set -l needs_excl_arg "__fish_seen_subcommand_from exclude; and not __fish_seen_subcommand_from list add remove" +complete -c dropbox -n $needs_excl_arg -xa list -d "Prints a list of directories currently excluded from syncing" +complete -c dropbox -n $needs_excl_arg -xa add -d "Adds one or more directories to the exclusion list" +complete -c dropbox -n $needs_excl_arg -xa remove -d "Removes one or more directories from the exclusion list" +complete -c dropbox -n "__fish_seen_subcommand_from exclude; and __fish_seen_subcommand_from remove" -xa '(dropbox exclude list | sed -e "1d")' +complete -c dropbox -n "__fish_seen_subcommand_from exclude; and __fish_seen_subcommand_from add" -xa '(set -l CDPATH; __fish_complete_cd)' + -- cgit v1.2.3