diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-05-05 14:09:39 +0200 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-05-05 14:09:39 +0200 |
commit | 6763ec25492acd03e0e64a6424306110b793bb59 (patch) | |
tree | 1a8b4974174022d04d7bd7a8bbc8aaf057661823 | |
parent | a7de856e9754ad539cfb37c622513e48e6b67d54 (diff) | |
download | dconf-6763ec25492acd03e0e64a6424306110b793bb59.tar.gz |
dconf cli: filter non-dirs for completion on list
-rw-r--r-- | bin/dconf-bash-completion.sh | 5 | ||||
-rw-r--r-- | bin/dconf.vala | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/bin/dconf-bash-completion.sh b/bin/dconf-bash-completion.sh index 4d10310..fc1e7aa 100644 --- a/bin/dconf-bash-completion.sh +++ b/bin/dconf-bash-completion.sh @@ -17,8 +17,11 @@ __dconf() { help) choices=$'help \nread \nlist \nwrite \nupdate \nlock \nunlock \nwatch ' ;; + list) + choices="$(dconf _complete / "${COMP_WORDS[2]}")" + ;; read|list|write|lock|unlock|watch) - choices="$(dconf _complete "${COMP_WORDS[2]}")" + choices="$(dconf _complete '' "${COMP_WORDS[2]}")" ;; esac ;; diff --git a/bin/dconf.vala b/bin/dconf.vala index 630ff9c..1b5b1ff 100644 --- a/bin/dconf.vala +++ b/bin/dconf.vala @@ -199,7 +199,8 @@ void dconf_watch (string?[] args) throws Error { } void dconf_complete (string[] args) throws Error { - var path = args[2]; + var suffix = args[2]; + var path = args[3]; if (path == "") { print ("/\n"); @@ -220,7 +221,7 @@ void dconf_complete (string[] args) throws Error { foreach (var item in client.list (dir)) { var full_item = dir + item; - if (full_item.has_prefix (path)) { + if (full_item.has_prefix (path) && item.has_suffix (suffix)) { print ("%s\n", full_item); } } |