diff options
author | dana <dana@dana.is> | 2018-01-05 14:26:17 -0600 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2018-01-06 00:13:51 +0100 |
commit | 0f0b602415961aa9ca069c9719a0fbb4bbb9941f (patch) | |
tree | 03001cfaf7ed12c26a354a996f52c4920d08cb76 /Completion/Darwin/Command/_mdfind | |
parent | 0c5f851021b3aacea96d9ca446282b8dab9f260d (diff) | |
download | zsh-0f0b602415961aa9ca069c9719a0fbb4bbb9941f.tar.gz zsh-0f0b602415961aa9ca069c9719a0fbb4bbb9941f.tar.xz zsh-0f0b602415961aa9ca069c9719a0fbb4bbb9941f.zip |
42231: new completion functions for simple utilities belonging to the 'Darwin' and 'Linux' groups.
Diffstat (limited to 'Completion/Darwin/Command/_mdfind')
-rw-r--r-- | Completion/Darwin/Command/_mdfind | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Completion/Darwin/Command/_mdfind b/Completion/Darwin/Command/_mdfind new file mode 100644 index 000000000..b38b0ee91 --- /dev/null +++ b/Completion/Darwin/Command/_mdfind @@ -0,0 +1,29 @@ +#compdef mdfind + +local ret=1 +local -a context line state state_descr tmp +local -A opt_args val_args + +_arguments -s -S : \ + '(-count)-0[separate result paths by NUL]' \ + '(-0)-count[display count of results instead of paths]' \ + '(-literal)-interpret[interpret query as if entered in Spotlight search field]' \ + '(-interpret)-literal[interpret query as literal query string]' \ + '-live[provide live updates to query results]' \ + '-onlyin[limit search to specified directory]: :_directories' \ + '(: -s)*-name[search for files with names matching specified string]:file name string' \ + '-reprint[reprint -live results on update]' \ + '(: -name)-s[show contents of specified smart folder]: :->smart-folders' \ + '(-s -name)1: :_guard "^-*" "query"' \ +&& ret=0 + +[[ $state == smart-folders ]] && { + tmp=( "$HOME/Library/Saved Searches/"*.savedSearch(-.N:r:t) ) + if (( $#tmp )); then + _values 'smart folder' $tmp && ret=0 + else + _message 'smart folder' && ret=0 + fi +} + +return ret |