diff options
author | axel <axel@liljencrantz.se> | 2006-12-09 07:58:55 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-12-09 07:58:55 +1000 |
commit | 1d3465698fb9f0d8e198daa8dd874a328bd1171b (patch) | |
tree | 3828a0e7c4994593bd50421f5ba9a615bb145c73 /share/completions/dcop.fish | |
parent | b156f083becf986a3f2ddac44ea28fb5cb91ce25 (diff) |
Add dcop completions, written by David Bitseff
darcs-hash:20061208215855-ac50b-aa2ee1fc551ce7bca50d5979800e6674015a3737.gz
Diffstat (limited to 'share/completions/dcop.fish')
-rw-r--r-- | share/completions/dcop.fish | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/share/completions/dcop.fish b/share/completions/dcop.fish new file mode 100644 index 00000000..047950af --- /dev/null +++ b/share/completions/dcop.fish @@ -0,0 +1,45 @@ +# +# Completions for the shell interface to the KDE DCOP server +# + +function __fish_complete_dcop -d "Completions for kde dcop" + set -l com (commandline) + + if eval "$com >/dev/null 2>&1" + # use dcop output if available + eval "$com | sed -e 's/^\w[^ ]* \(\w*\)([^)]*)\$/\1/'" + + else + set -l op (commandline -o) + + if test (count $op) -le 2 + # select an application + dcop | grep -- $op[-1] + else + # select a function + set -l o + for i in (seq 1 (count $op)) + # strip the \ character which causes problems + set o[$i] (echo $op[$i] | sed -e 's/\\\//g') + end + + set -l idx (seq 2 (expr (count $o) - 1)) + # list only function names + dcop $o[$idx] | grep -- $o[-1] | sed -e 's/^\w[^ ]* \(\w*\)([^)]*)$/\1/' + end + end +end + + +complete -c dcop -l help -s h -f -d (N_ "Show help about options") +complete -c dcop -l user -x -a '(awk -F: "{print \$1}" /etc/passwd)' -d (N_ "Connect to the given user's DCOP server") +complete -c dcop -l all-users -f -d (N_ "Send the same DCOP call to all users with a running DCOP server") +complete -c dcop -l list-sessions -f -d (N_ "List all active KDE session for a user or all users") +complete -c dcop -l session -x -a '(dcop --list-sessions --all-users | grep DCOP)' -d (N_ "Send to the given KDE session") +complete -c dcop -l no-user-time -f -d (N_ "Don't update the user activity timestamp in the called application") +complete -c dcop -l pipe -f -d (N_ "Call DCOP for each line read from stdin") + +complete -c dcop -x -a "(__fish_complete_dcop)" + + + |