summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAllison Ryan Lortie <desrt@desrt.ca>2015-11-30 14:57:18 -0500
committerAllison Ryan Lortie <desrt@desrt.ca>2015-11-30 14:59:10 -0500
commitd8e817869b4e67eceed6b1e6e029a47244fd85af (patch)
treec73c79d15c3c86496dce98ee7b09201640bdb098 /bin
parente7705f6d999486b0c840bedf97f219d36d188ca8 (diff)
downloaddconf-d8e817869b4e67eceed6b1e6e029a47244fd85af.tar.gz
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
Diffstat (limited to 'bin')
-rw-r--r--bin/dconf.vala22
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));