diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2015-01-25 20:53:57 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2015-01-25 21:10:42 +0100 |
commit | e97b1f3c91af1457f844d1e0e6a3cb953bc7b770 (patch) | |
tree | 9a57cb9ca6ed9660c7b275fce34a260d85eee57e /src | |
parent | 83dd5e2974b57f8a1eb51d57fd7e60e8ae5a66a9 (diff) |
qmicli: add command completion
https://bugs.freedesktop.org/show_bug.cgi?id=87900
Diffstat (limited to 'src')
-rw-r--r-- | src/qmicli/Makefile.am | 12 | ||||
-rw-r--r-- | src/qmicli/qmicli-completion | 147 |
2 files changed, 159 insertions, 0 deletions
diff --git a/src/qmicli/Makefile.am b/src/qmicli/Makefile.am index e895c8d..a8432ac 100644 --- a/src/qmicli/Makefile.am +++ b/src/qmicli/Makefile.am @@ -26,3 +26,15 @@ qmicli_SOURCES = \ qmicli_LDADD = \ $(GLIB_LIBS) \ $(top_builddir)/src/libqmi-glib/libqmi-glib.la + + +completiondir = $(datadir)/bash-completion/completions + +install-data-hook: + $(mkinstalldirs) $(DESTDIR)$(completiondir) + $(INSTALL_DATA) $(srcdir)/qmicli-completion $(DESTDIR)$(completiondir)/qmicli + +uninstall-hook: + rm -f $(DESTDIR)$(completiondir)/qmicli + +EXTRA_DIST = qmicli-completion diff --git a/src/qmicli/qmicli-completion b/src/qmicli/qmicli-completion new file mode 100644 index 0000000..f35927f --- /dev/null +++ b/src/qmicli/qmicli-completion @@ -0,0 +1,147 @@ +# qmicli(1) completion -*- shell-script -*- + +_qmicli() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -d|--device) + _filedir + return 0 + ;; + '--device-set-instance-id') + COMPREPLY=( $(compgen -W "[Instance-ID]" -- $cur) ) + return 0 + ;; + '--device-open-net') + COMPREPLY=( $(compgen -W "[net-802-3|net-raw-ip|net-qos-header|net-no-qos-header]" -- $cur) ) + return 0 + ;; + '--client-cid') + COMPREPLY=( $(compgen -W "[CID]" -- $cur) ) + return 0 + ;; + '--dms-uim-set-pin-protection') + COMPREPLY=( $(compgen -W "[(PIN|PIN2),(disable|enable),(current-PIN)]" -- $cur) ) + return 0 + ;; + '--dms-uim-verify-pin') + COMPREPLY=( $(compgen -W "[(PIN|PIN2),(current-PIN)]" -- $cur) ) + return 0 + ;; + '--dms-uim-unblock-pin') + COMPREPLY=( $(compgen -W "[(PIN|PIN2),(PUK),(new-PIN)]" -- $cur) ) + return 0 + ;; + '--dms-uim-change-pin') + COMPREPLY=( $(compgen -W "[(PIN|PIN2),(old-PIN),(new-PIN)]" -- $cur) ) + return 0 + ;; + '--dms-uim-get-ck-status') + COMPREPLY=( $(compgen -W "[(pn|pu|pp|pc|pf)]" -- $cur) ) + return 0 + ;; + '--dms-uim-set-ck-protection') + COMPREPLY=( $(compgen -W "[(pn|pu|pp|pc|pf),(disable),(key)]" -- $cur) ) + return 0 + ;; + '--dms-uim-unblock-ck') + COMPREPLY=( $(compgen -W "[(pn|pu|pp|pc|pf),(key)]" -- $cur) ) + return 0 + ;; + '--dms-set-operating-mode') + COMPREPLY=( $(compgen -W "[(Operating-Mode)]" -- $cur) ) + return 0 + ;; + '--dms-activate-automatic') + COMPREPLY=( $(compgen -W "[Activation-Code]" -- $cur) ) + return 0 + ;; + '--dms-activate-manual') + COMPREPLY=( $(compgen -W "[SPC,SID,MDN,MIN]" -- $cur) ) + return 0 + ;; + '--dms-set-user-lock-state') + COMPREPLY=( $(compgen -W "[(disable|enable),(current-lock-code)]" -- $cur) ) + return 0 + ;; + '--dms-set-user-lock-code') + COMPREPLY=( $(compgen -W "[(old-lock-code),(new-lock-code)]" -- $cur) ) + return 0 + ;; + '--dms-write-user-data') + COMPREPLY=( $(compgen -W "[(User-data)]" -- $cur) ) + return 0 + ;; + '--dms-restore-factory-defaults') + COMPREPLY=( $(compgen -W "[(Service-Programming-Code)]" -- $cur) ) + return 0 + ;; + '--dms-validate-service-programming-code') + COMPREPLY=( $(compgen -W "[(Service-Programming-Code)]" -- $cur) ) + return 0 + ;; + '--dms-select-stored-image') + COMPREPLY=( $(compgen -W "[modem#,pri#]" -- $cur) ) + return 0 + ;; + '--dms-delete-stored-image') + COMPREPLY=( $(compgen -W "[modem#,pri#]" -- $cur) ) + return 0 + ;; + '--nas-get-tx-rx-info') + COMPREPLY=( $(compgen -W "[(Radio-Interface)]" -- $cur) ) + return 0 + ;; + '--nas-set-system-selection-preference') + COMPREPLY=( $(compgen -W "[cdma-1x|cdma-1xevdo|gsm|umts|lte|td-scdma]" -- $cur) ) + return 0 + ;; + '--wds-start-network') + COMPREPLY=( $(compgen -W "[(APN),(PAP|CHAP|BOTH),(Username),(Password)]" -- $cur) ) + return 0 + ;; + '--wds-stop-network') + COMPREPLY=( $(compgen -W "[Packet-data-handle]" -- $cur) ) + return 0 + ;; + '--wds-get-profile-list') + COMPREPLY=( $(compgen -W "[3gpp|3gpp2]" -- $cur) ) + return 0 + ;; + '--wds-get-default-settings') + COMPREPLY=( $(compgen -W "[3gpp|3gpp2]" -- $cur) ) + return 0 + ;; + '--uim-read-transparent') + COMPREPLY=( $(compgen -W "[0xNNNN,0xNNNN,...]" -- $cur) ) + return 0 + ;; + '--uim-get-file-attributes') + COMPREPLY=( $(compgen -W "[0xNNNN,0xNNNN,...]" -- $cur) ) + return 0 + ;; + '--wda-set-data-format') + COMPREPLY=( $(compgen -W "[raw-ip|802-3]" -- $cur) ) + return 0 + ;; + '-V'|'--version') + return 0 + ;; + '-h'|'--help'|'--help-all'|'--help-dms'|'--help-nas'|'--help-wds'|'--help-pbm'|'--help-uim'|'--help-wda') + return 0 + ;; + esac + + $split && return 0 + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi +} && +complete -F _qmicli qmicli + +# ex: ts=4 sw=4 et filetype=sh |