diff options
author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2018-11-14 00:00:00 +0000 |
---|---|---|
committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2018-11-15 23:43:53 +0100 |
commit | 1f5e6a04ab92acdb6ef3e6136af7ecf119d82d9b (patch) | |
tree | 1f16243bfeb90504dc12b4a39d28732b00cd9e76 | |
parent | 66d32800f57a075603dc3e9e40793077a9bbafcf (diff) | |
download | dconf-1f5e6a04ab92acdb6ef3e6136af7ecf119d82d9b.tar.gz |
bin: Add optional directory argument for update command
This make it possible to create integration tests for dconf update
without having access to SYSCONFDIR/dconf/db.
-rw-r--r-- | bin/dconf-update.vala | 14 | ||||
-rw-r--r-- | bin/dconf.vala | 2 |
2 files changed, 14 insertions, 2 deletions
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 1f0109c..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": |