diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Unix/Command/_elinks | 2 | ||||
-rw-r--r-- | Completion/Unix/Type/.distfiles | 1 | ||||
-rwxr-xr-x | Completion/Unix/Type/_mime_types | 42 | ||||
-rw-r--r-- | Completion/X/Command/.distfiles | 1 | ||||
-rwxr-xr-x | Completion/X/Command/_kfmclient | 93 |
5 files changed, 138 insertions, 1 deletions
diff --git a/Completion/Unix/Command/_elinks b/Completion/Unix/Command/_elinks index 53e7b8ac8..615d9ba80 100644 --- a/Completion/Unix/Command/_elinks +++ b/Completion/Unix/Command/_elinks @@ -11,7 +11,7 @@ _arguments -C -A '-*' \ '*-base-session[clone session with given ID]:ID number:' \ '*-confdir[set config dir to given string]:configuration directory:_files -/' \ '*-conffile[configuration file name]:configuration file:_files' \ - '*-default-mime-type[MIME type to assume for documents]:MIME type:' \ + '*-default-mime-type[MIME type to assume for documents]:MIME type:_mime_types' \ '*-dump[write formatted version of given URL to stdout]::boolean:(0 1)' \ '*-dump-charset[codepage to use with -dump]:codepage:' \ '*-dump-width[width of document formatted with -dump]:width:' \ diff --git a/Completion/Unix/Type/.distfiles b/Completion/Unix/Type/.distfiles index 5d4676bac..1392115dd 100644 --- a/Completion/Unix/Type/.distfiles +++ b/Completion/Unix/Type/.distfiles @@ -10,4 +10,5 @@ _groups _perl_basepods _signals _users_on _hosts _tar_archive _time_zone _file_systems _net_interfaces _terminals _locales _java_class _services _email_addresses _global_tags +_mime_types ' diff --git a/Completion/Unix/Type/_mime_types b/Completion/Unix/Type/_mime_types new file mode 100755 index 000000000..1a967501c --- /dev/null +++ b/Completion/Unix/Type/_mime_types @@ -0,0 +1,42 @@ +#autoload + +local expl maintype +local -a default_type_files type_files match mbegin mend +integer ind + +default_type_files=(~/.mime.types /etc/mime.types) + +# This is the same style as used by zsh-mime-setup, with a different +# context. +if zstyle -a ":completion:${curcontext}:mime" mime-types type_files; then + while (( (ind = ${type_files[(I)+]}) > 0 )); do + type_files[$ind]=($default_type_files) + done +else + type_files=($default_type_files) +fi + +# +# Handle two different mime type formats; the simple +# format: +# application/x-pws-frobnicate psf pwsf +# and the extended format +# type=application/x-pws-frobnicate \ +# desc="PWS frobnicated widget" \ +# exts="pwsf,psf" +# which Netscape seems to like. +# + +if [[ $PREFIX = (#b)([^/]##)/* ]]; then + # Search for subtype. + maintype=$match[1] + compset -p $(( ${#maintype} + 1 )) + _wanted mimesubtype expl 'MIME subtype' \ + compadd -- $(sed -ne "s%^\(type=\|\)${maintype}/\([^ ]*\).*$%\2%p" \ + $type_files) +else + # Search for main type. + _wanted mimetype expl 'MIME type' \ + compadd -S/ -- $(sed -ne "s/^type=//" \ + -e "s%^\(${PREFIX:-[a-z]}[^=\"]*\)/.*$%\1%p" $type_files) +fi diff --git a/Completion/X/Command/.distfiles b/Completion/X/Command/.distfiles index 391411168..d188982b7 100644 --- a/Completion/X/Command/.distfiles +++ b/Completion/X/Command/.distfiles @@ -3,4 +3,5 @@ DISTFILES_SRC=' _gv _netscape _xauth _xfig _mozilla _xterm _xwit _nedit _vnc _x_utils _xdvi _xmodmap _xset _xv _acroread _dcop _gqview _xloadimage _mplayer +_kfmclient ' diff --git a/Completion/X/Command/_kfmclient b/Completion/X/Command/_kfmclient new file mode 100755 index 000000000..f83e51779 --- /dev/null +++ b/Completion/X/Command/_kfmclient @@ -0,0 +1,93 @@ +#compdef kfmclient + +local expl +local -a context state line +typeset -A opt_args + +_arguments \ + '--help[show help message]' \ + '--help-qt[show Qt specific options]' \ + '--help-kde[show KDE specific options]' \ + '--help-all[show all options]' \ + '--author[show author information]' \ + '-v[show version information]' \ + '--version[show version information]' \ + '--license[show license information]' \ + '--commands[show available commands]' \ + '--display=:X display:_x_display' \ + '--session=:session id for restoring application: ' \ + '--cmap[use private colormap (8-bit display)]' \ + '--ncols=:limit on number of colors (8-bit display): ' \ + '--nograb[never grab mouse or keyboard]' \ + '--dograb[override nograb in debugger]' \ + '--sync[switch to synchronous mode when debugging]' \ + '--fn=:font name:_x_font' \ + '--font=:font name:_x_font' \ + '--bg=:background color:_x_color' \ + '--background=:background color:_x_color' \ + '--fg=:foreground color:_x_color' \ + '--foreround=:foreground color:_x_color' \ + '--btn=:button color:_x_color' \ + '--button=:button color:_x_color' \ + '--name=:application name: ' \ + '--title=:application title (caption): ' \ + '--visual=:specify visual:_x_visual' \ + '--inputstyle:X input method:(onthespot overthespot offthespot root)' \ + '--im:X Input Method server: ' \ + '--noxim[disable X Input Method]' \ + '--reverse[reverse widget layout]' \ + '--caption=:name in titlebar: ' \ + '--icon=:application icon: ' \ + '--miniicon=:icon in titlebar: ' \ + '--config=:configuration file:_files' \ + '--dcopserver=:DCOP server: ' \ + '--nocrashhandler[disable crash handler, allow core dumps]' \ + '--waitforwm[Wait for a WM_NET compatible window manager]' \ + '--style=:GUI style for application: ' \ + '--geometry=:client window geometry:_x_geometry' \ + '1:client command:(openURL openProfile openProperties exec move +download copy sortDesktop configure configureDesktop)' \ + '2::args:->firstarg' \ + '3::args:->secondarg' && return 0 + +[[ $state = *arg ]] || return 1 + +# Argument to previous command. + +print $line >/tmp/tmp.out + +case $line[1] in + (openURL) + if [[ $state = secondarg ]]; then + _mime_types && return 0 + elif [[ $state = firstarg ]]; then + _urls && return 0 + fi + ;; + + (openProfile) + if [[ $state = secondarg ]]; then + _urls && return 0 + elif [[ $state = firstarg ]]; then + _wanted profile expl 'Konqueror profile' \ + compadd -- ~/.kde/share/apps/konqueror/profiles/*(:t) && return 0 + fi + ;; + + (exec) + if [[ $state = secondarg ]]; then + # TODO: could probe inside Desktop files. + _message "KDE binding" && return 0 + elif [[ $state = firstarg ]]; then + _urls && return 0 + fi + ;; + + (move|download|openProperties) + if [[ $state = firstarg ]]; then + _urls && return 0 + fi + ;; +esac + +_message "no more arguments" |