summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Playfair Cal <daniel.playfair.cal@gmail.com>2018-11-19 00:34:39 +0000
committerDaniel Playfair Cal <daniel.playfair.cal@gmail.com>2018-11-19 00:34:39 +0000
commit725bc9756236996f3ff00bc8f7545b8f7c24b789 (patch)
treecef5e8911a7ebd66524e838e8e3ae81ce5fc7e4c /bin
parent0b440a2e8689dcd7bdf70b69aff6125751b936a0 (diff)
parentd9291a127654dc94b92c758dcdb2f3d421087841 (diff)
downloaddconf-725bc9756236996f3ff00bc8f7545b8f7c24b789.tar.gz
Merge branch 'integration-test-2' into 'master'
Add further integration tests See merge request GNOME/dconf!33
Diffstat (limited to 'bin')
-rw-r--r--bin/dconf-dump.vala8
-rw-r--r--bin/dconf-update.vala14
-rw-r--r--bin/dconf.vala40
3 files changed, 60 insertions, 2 deletions
diff --git a/bin/dconf-dump.vala b/bin/dconf-dump.vala
index d63e3eb..26f62d0 100644
--- a/bin/dconf-dump.vala
+++ b/bin/dconf-dump.vala
@@ -39,6 +39,10 @@ void dconf_dump (string[] args) throws Error {
DConf.verify_dir (dir);
+ if (args[3] != null) {
+ throw new OptionError.FAILED ("too many arguments");
+ }
+
add_to_keyfile (kf, client, dir);
print ("%s", kf.to_data ());
}
@@ -62,6 +66,10 @@ void dconf_load (string[] args) throws Error {
var dir = args[2];
DConf.verify_dir (dir);
+ if (args[3] != null) {
+ throw new OptionError.FAILED ("too many arguments");
+ }
+
var changeset = new DConf.Changeset ();
var kf = keyfile_from_stdin ();
diff --git a/bin/dconf-update.vala b/bin/dconf-update.vala
index 55a8231..520e02d 100644
--- a/bin/dconf-update.vala
+++ b/bin/dconf-update.vala
@@ -251,7 +251,19 @@ void dconf_compile (string[] args) throws GLib.Error {
extern const string CONFIG_SYSCONFDIR;
void dconf_update (string[] args) throws GLib.Error {
- update_all (CONFIG_SYSCONFDIR + "/dconf/db");
+ var index = 2;
+ var dbpath = CONFIG_SYSCONFDIR + "/dconf/db";
+
+ if (args[index] != null) {
+ dbpath = args[index];
+ index ++;
+ }
+
+ if (args[index] != null) {
+ throw new OptionError.FAILED ("too many arguments");
+ }
+
+ update_all (dbpath);
}
// vim:noet ts=4 sw=4
diff --git a/bin/dconf.vala b/bin/dconf.vala
index 8b0f211..6448808 100644
--- a/bin/dconf.vala
+++ b/bin/dconf.vala
@@ -64,7 +64,7 @@ void show_help (bool requested, string? command) {
case "update":
description = "Update the system dconf databases";
- synopsis = "";
+ synopsis = " [DIR] ";
break;
case "watch":
@@ -173,6 +173,10 @@ void dconf_read (string?[] args) throws Error {
DConf.verify_key (key);
+ if (args[index + 1] != null) {
+ throw new OptionError.FAILED ("too many arguments");
+ }
+
var result = client.read_full (key, flags, null);
if (result != null) {
@@ -200,6 +204,10 @@ void dconf_list_locks (string?[] args) throws Error {
DConf.verify_dir (dir);
+ if (args[3] != null) {
+ throw new OptionError.FAILED ("too many arguments");
+ }
+
foreach (var item in client.list_locks (dir)) {
print ("%s\n", item);
}
@@ -208,10 +216,21 @@ void dconf_list_locks (string?[] args) throws Error {
void dconf_write (string?[] args) throws Error {
var client = new DConf.Client ();
var key = args[2];
+ if (key == null) {
+ throw new OptionError.FAILED ("key not specified");
+ }
+
var val = args[3];
+ if (val == null) {
+ throw new OptionError.FAILED ("value not specified");
+ }
DConf.verify_key (key);
+ if (args[4] != null) {
+ throw new OptionError.FAILED ("too many arguments");
+ }
+
client.write_sync (key, Variant.parse (null, val));
}
@@ -229,6 +248,10 @@ void dconf_reset (string?[] args) throws Error {
DConf.verify_path (path);
+ if (args[index + 1] != null) {
+ throw new OptionError.FAILED ("too many arguments");
+ }
+
if (DConf.is_dir (path) && !force) {
throw new OptionError.FAILED ("-f must be given to (recursively) reset entire dirs");
}
@@ -259,6 +282,10 @@ void dconf_watch (string?[] args) throws Error {
DConf.verify_path (path);
+ if (args[3] != null) {
+ throw new OptionError.FAILED ("too many arguments");
+ }
+
client.changed.connect (watch_function);
client.watch_sync (path);
@@ -274,7 +301,18 @@ void dconf_blame (string?[] args) throws Error {
void dconf_complete (string[] args) throws Error {
var suffix = args[2];
+ if (suffix == null) {
+ throw new OptionError.FAILED ("suffix not specified");
+ }
+
var path = args[3];
+ if (path == null) {
+ throw new OptionError.FAILED ("path not specified");
+ }
+
+ if (args[4] != null) {
+ throw new OptionError.FAILED ("too many arguments");
+ }
if (path == "") {
print ("/\n");