From d8e817869b4e67eceed6b1e6e029a47244fd85af Mon Sep 17 00:00:00 2001 From: Allison Ryan Lortie Date: Mon, 30 Nov 2015 14:57:18 -0500 Subject: 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 file 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)); -- cgit v1.2.1