[dconf] dconf(1): add -d option to 'dconf read'



commit d8e817869b4e67eceed6b1e6e029a47244fd85af
Author: Allison Ryan Lortie <desrt desrt ca>
Date:   Mon Nov 30 14:57:18 2015 -0500

    dconf(1): add -d option to 'dconf read'
    
    Add a -d option to 'dconf read' to read the default value.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758864

 bin/dconf.vala |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/bin/dconf.vala b/bin/dconf.vala
index 954d6c8..1c054cd 100644
--- a/bin/dconf.vala
+++ b/bin/dconf.vala
@@ -33,8 +33,8 @@ void show_help (bool requested, string? command) {
                        break;
 
                case "read":
-                       description = "Read the value of a key";
-                       synopsis = " KEY ";
+                       description = "Read the value of a key.  -d to read default values.";
+                       synopsis = " [-d] KEY ";
                        break;
 
                case "list":
@@ -161,11 +161,25 @@ void dconf_help (string[] args) throws Error {
 
 void dconf_read (string?[] args) throws Error {
        var client = new DConf.Client ();
-       var key = args[2];
+       bool read_default = false;
+       var index = 2;
+
+       if (args[index] == "-d") {
+               read_default = true;
+               index++;
+       }
+
+       var key = args[index];
 
        DConf.verify_key (key);
 
-       var result = client.read (key);
+       Variant? result;
+
+       if (read_default) {
+               result = client.read_default (key);
+       } else {
+               result = client.read (key);
+       }
 
        if (result != null) {
                print ("%s\n", result.print (true));


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