[dconf] dconf cli: filter non-dirs for completion on list



commit 6763ec25492acd03e0e64a6424306110b793bb59
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu May 5 14:09:39 2011 +0200

    dconf cli: filter non-dirs for completion on list

 bin/dconf-bash-completion.sh |    5 ++++-
 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);
 			}
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]