diff options
-rw-r--r-- | doc/dwbem.1 | 24 | ||||
-rw-r--r-- | doc/dwbem.1.txt | 20 | ||||
-rw-r--r-- | tools/dwbem.c | 30 |
3 files changed, 53 insertions, 21 deletions
diff --git a/doc/dwbem.1 b/doc/dwbem.1 index 6ae12403..10e934a7 100644 --- a/doc/dwbem.1 +++ b/doc/dwbem.1 @@ -82,11 +82,6 @@ Show information about \fIextension\fR\&. .RE .PP -\fB\-r\fR \fIextension\fR, \fB\-\-remove\fR \fIextension\fR -.RS 4 -Remove an extension\&. If it is a remote extension the extension will be deleted\&. This option also discards the configuration\&. -.RE -.PP \fB\-l\fR, \fB\-\-list\fR .RS 4 List installed extensions\&. @@ -100,7 +95,7 @@ Edit configuration for \fB\-B\fR\&. .RE .PP -\fB\-n\fR, \fB\-\-noconfig\fR +\fB\-n\fR, \fB\-\-no\-config\fR .RS 4 Don\(cqt use a configuration in the loader script, use \fI$XDG_CONFIG_HOME/dwb/extensionrc\fR @@ -114,6 +109,23 @@ or it will be applied to all installed extensions\&. .RE .PP +\fB\-N\fR, \fB\-\-no\-confirm\fR +.RS 4 +Can be combined with +\fB\-i\fR +or +\fB\-u\fR\&. When set all questions are skipped\&. When combined with +\fB\-i\fR +an existing configuration will be overwritten with the default configuration\&. When combined with +\fB\-u\fR +the check for changed configurations is skipped\&. +.RE +.PP +\fB\-r\fR \fIextension\fR, \fB\-\-remove\fR \fIextension\fR +.RS 4 +Remove an extension\&. If it is a remote extension the extension will be deleted\&. This option also discards the configuration\&. +.RE +.PP \fB\-u\fR, \fB\-\-update\fR .RS 4 Update installed extensions\&. diff --git a/doc/dwbem.1.txt b/doc/dwbem.1.txt index 0c324c97..88e69c18 100644 --- a/doc/dwbem.1.txt +++ b/doc/dwbem.1.txt @@ -54,11 +54,6 @@ OPTIONS *--info* 'extension':: Show information about 'extension'. -*-r* 'extension':: -*--remove* 'extension':: - Remove an extension. If it is a remote extension the extension will be - deleted. This option also discards the configuration. - *-l*:: *--list*:: List installed extensions. @@ -69,13 +64,26 @@ OPTIONS 'extensions.load', see also *-B*. *-n*:: -*--noconfig*:: +*--no-config*:: Don't use a configuration in the loader script, use '$XDG_CONFIG_HOME/dwb/extensionrc' instead. The extension will simply be loaded with 'extensions.load("extension");'. This option can be combined with *-i*, *-B* or *-L*. If combined with *-i* it will be applied to all installed extensions. +*-N*:: +*--no-confirm*:: + Can be combined with *-i* or *-u*. When set all questions are skipped. When + combined with *-i* an existing configuration will be overwritten with the + default configuration. When combined with *-u* the check for changed + configurations is skipped. + +*-r* 'extension':: +*--remove* 'extension':: + Remove an extension. If it is a remote extension the extension will be + deleted. This option also discards the configuration. + + *-u*:: *--update*:: Update installed extensions. diff --git a/tools/dwbem.c b/tools/dwbem.c index 445d6207..8573dee5 100644 --- a/tools/dwbem.c +++ b/tools/dwbem.c @@ -45,10 +45,11 @@ enum { - F_NO_CONFIG = 1<<0, - F_BIND = 1<<1, - F_FORCE = 1<<2, - F_UPDATE = 1<<2 + F_NO_CONFIG = 1<<0, + F_BIND = 1<<1, + F_FORCE = 1<<2, + F_UPDATE = 1<<3, + F_NO_CONFIRM = 1<<4, }; enum { @@ -429,7 +430,12 @@ add_to_loader(const char *name, const char *content, int flags) if (matches[1] == NULL) notify("No default configuration found"); - else if (flags & F_UPDATE) + else if (flags & F_NO_CONFIRM) { + notify("Skipping configuration check"); + if (! (flags & F_UPDATE) ) + new_config = matches[1]; + } + else if ((flags & F_UPDATE)) { data = get_data(name, m_loader, TMPL_CONFIG, 0); if (diff(data, matches[1], &config) == 0) { @@ -444,7 +450,8 @@ add_to_loader(const char *name, const char *content, int flags) else new_config = matches[1]; - set_loader(name, new_config, flags); + if ( (flags & F_NO_CONFIRM) == 0 || (flags & F_UPDATE) == 0 ) + set_loader(name, new_config, flags); g_strfreev(matches); g_free(config); @@ -671,6 +678,7 @@ cl_install(const char *name, int flags) { if (!(flags & F_FORCE) && check_installed(name) + && !(flags & F_NO_CONFIRM) && !yes_no(0, EXT(%s)" is already installed, continue anyway", name)) return -1; @@ -754,7 +762,7 @@ do_upate(const char *meta, int flags) if (space != NULL) { snprintf(buffer, MIN(128, space - meta + 1), meta); - if (yes_no(1, "Update "EXT(%s), buffer)) + if ((flags & F_NO_CONFIRM) || yes_no(1, "Update "EXT(%s), buffer)) if (cl_install(buffer, flags | F_FORCE | F_UPDATE)) notify(EXT(%s)" successfully updated", buffer); } @@ -927,6 +935,7 @@ main(int argc, char **argv) gboolean o_update = false; gboolean o_list_installed = false; gboolean o_list_all = false; + gboolean o_no_confirm = false; int flags = 0; GOptionEntry options[] = { { "list-all", 'a', 0, G_OPTION_ARG_NONE, &o_list_all, "List all installed extensions", NULL}, @@ -936,10 +945,11 @@ main(int argc, char **argv) { "enable", 'e', 0, G_OPTION_ARG_STRING_ARRAY, &o_enable, "Enable <extension>", "<extension>" }, { "install", 'i', 0, G_OPTION_ARG_STRING_ARRAY, &o_install, "Install <extension>", "<extension>" }, { "info", 'I', 0, G_OPTION_ARG_STRING_ARRAY, &o_info, "Show info about <extension>", "<extension>" }, - { "remove", 'r', 0, G_OPTION_ARG_STRING_ARRAY, &o_remove, "Remove <extension>", "<extension>" }, { "list-installed", 'l', 0, G_OPTION_ARG_NONE, &o_list_installed, "List installed extensions", NULL}, { "setload", 'L', 0, G_OPTION_ARG_STRING_ARRAY, &o_setload, "Edit configuration for <extension>, use exensions.load", "<extension>" }, - { "noconfig", 'n', 0, G_OPTION_ARG_NONE, &o_noconfig, "Don't use config in loader script, use extensionrc instead", NULL }, + { "no-config", 'n', 0, G_OPTION_ARG_NONE, &o_noconfig, "Don't use config in loader script, use extensionrc instead", NULL }, + { "no-confirm", 'N', 0, G_OPTION_ARG_NONE, &o_no_confirm, "Update extensions", NULL }, + { "remove", 'r', 0, G_OPTION_ARG_STRING_ARRAY, &o_remove, "Remove <extension>", "<extension>" }, { "update", 'u', 0, G_OPTION_ARG_NONE, &o_update, "Update extensions", NULL }, { NULL }, }; @@ -986,6 +996,8 @@ main(int argc, char **argv) flags |= F_BIND; if (o_noconfig) flags |= F_NO_CONFIG; + if (o_no_confirm) + flags |= F_NO_CONFIRM; if (o_list_all) cl_list_all(flags); |