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 /bin/dconf-update.vala | |
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.
Diffstat (limited to 'bin/dconf-update.vala')
-rw-r--r-- | bin/dconf-update.vala | 14 |
1 files changed, 13 insertions, 1 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 |