summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2015-01-27 16:23:13 +1300
committerRobert Ancell <robert.ancell@canonical.com>2015-01-27 16:23:13 +1300
commit0b11b6b4b4cf1bf7c60d2e5aa5ab9bde2fdecca9 (patch)
tree2c0183d60a3dd438d739b7fbdbabfc5db136a6c4 /data
parent2acc8db843156306e07aeab2d7c3fee7385968af (diff)
downloadlightdm-0b11b6b4b4cf1bf7c60d2e5aa5ab9bde2fdecca9.tar.gz
Add bash autocompletion for dm-tool
Diffstat (limited to 'data')
-rw-r--r--data/Makefile.am3
-rw-r--r--data/bash-completion/dm-tool51
2 files changed, 54 insertions, 0 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index b5601b94..63cdc095 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -12,6 +12,9 @@ dist_pam_DATA = pam/lightdm \
pam/lightdm-autologin \
pam/lightdm-greeter
+completionsdir = $(datadir)/bash-completion/completions
+dist_completions_DATA = bash-completion/dm-tool
+
lightdm-guest-session: $(srcdir)/apparmor/lightdm-guest-session.in
sed -e 's|@libexecdir[@]|$(libexecdir)|g' $< >$@
diff --git a/data/bash-completion/dm-tool b/data/bash-completion/dm-tool
new file mode 100644
index 00000000..15503959
--- /dev/null
+++ b/data/bash-completion/dm-tool
@@ -0,0 +1,51 @@
+#-*- mode: shell-script;-*-
+
+_dm_tool()
+{
+ local cur prev opts
+ _init_completion || return
+ opts='switch-to-greeter switch-to-user switch-to-guest lock list-seats add-nested-seat add-local-x-seat add-seat'
+
+ case "$prev" in
+ switch-to-greeter)
+ return 0
+ ;;
+ switch-to-user)
+ COMPREPLY=($(compgen -u -- "${cur}"))
+ return 0
+ ;;
+ switch-to-guest)
+ # FIXME: session name
+ return 0
+ ;;
+ lock)
+ return 0
+ ;;
+ list-seats)
+ return 0
+ ;;
+ add-nested-seat)
+ # FIXME ...
+ return 0
+ ;;
+ add-local-x-seat)
+ # FIXME ...
+ return 0
+ ;;
+ add-seat)
+ # FIXME ...
+ return 0
+ ;;
+ *)
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
+ return 0
+}
+complete -F _dm_tool dm-tool