diff options
author | portix <none@none> | 2013-02-01 14:07:48 +0100 |
---|---|---|
committer | portix <none@none> | 2013-02-01 14:07:48 +0100 |
commit | a0cca2060ce9af67847eb8af5a5add942662b755 (patch) | |
tree | 3f89c974b17ae6a23bc19b8929c2562d397d0fab /tools | |
parent | 3182ab0b97f621f4e4fd5a4f56e8d7400a995ccd (diff) | |
download | dwb-a0cca2060ce9af67847eb8af5a5add942662b755.zip |
Indicate installed/disabled extensions when calling dwbem -a/-l
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dwbem.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/dwbem.c b/tools/dwbem.c index 8ee15402..39750276 100644 --- a/tools/dwbem.c +++ b/tools/dwbem.c @@ -929,16 +929,41 @@ get_list(const char *path) static void list(const char *file, const char *message, gboolean sync) { + char buffer[128]; if (sync) sync_meta(file); char **list = get_list(file); + char suffix[3]; + int c; + + char *content = NULL; + if (list != NULL) { + g_file_get_contents(m_loader, &content, NULL, NULL); notify("%s:", message); for (int i=0; list[i]; i++) - printf(" * %s\n", list[i]); + { + c=0; + if (sync && grep(m_installed, list[i], buffer, sizeof(buffer)) > 0) + suffix[c++] = 'i'; + else if (sync) + suffix[c++] = ' '; + + if (content != NULL) { + char *regex = g_strdup_printf("/\\*<%s"TMPL_DISABLED, list[i]); + if (g_regex_match_simple(regex, content, G_REGEX_DOTALL, 0)) + suffix[c++] = 'd'; + else + suffix[c++] = ' '; + g_free(regex); + } + suffix[c] = '\0'; + printf("%s - %s\n", suffix, list[i]); + } g_strfreev(list); + g_free(content); } else notify("No extensions installed"); |