[dconf: 3/6] bin: Add optional directory argument for update command
- From: Daniel Playfair Cal <danielplayfaircal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf: 3/6] bin: Add optional directory argument for update command
- Date: Mon, 19 Nov 2018 00:35:04 +0000 (UTC)
commit 1f5e6a04ab92acdb6ef3e6136af7ecf119d82d9b
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date: Wed Nov 14 00:00:00 2018 +0000
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.
bin/dconf-update.vala | 14 +++++++++++++-
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":
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]