summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-06-03 08:07:14 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-06-03 08:07:14 (GMT)
commitad6a7e48f47b06f24664eab21a9665558b704ff1 (patch)
tree638056bbebf89eaebfd69627ec015d5854f78ed5 /src
parentbfaec62d795ffe17ef82640efa06be6b056475cc (diff)
downloadfluxbox_lack-ad6a7e48f47b06f24664eab21a9665558b704ff1.zip
fluxbox_lack-ad6a7e48f47b06f24664eab21a9665558b704ff1.tar.bz2
add new command line option -list-commands
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/CommandParser.hh2
-rw-r--r--src/main.cc10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/FbTk/CommandParser.hh b/src/FbTk/CommandParser.hh
index 45ce001..3e40ed6 100644
--- a/src/FbTk/CommandParser.hh
+++ b/src/FbTk/CommandParser.hh
@@ -128,7 +128,7 @@ public:
128 return it->second; 128 return it->second;
129 } 129 }
130 130
131 const CreatorMap creatorMap() const { return m_creators; } 131 const CreatorMap &creatorMap() const { return m_creators; }
132 132
133private: 133private:
134 CommandParser() {} 134 CommandParser() {}
diff --git a/src/main.cc b/src/main.cc
index 9da51ec..bc43a93 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -26,7 +26,7 @@
26 26
27#include "FbTk/Theme.hh" 27#include "FbTk/Theme.hh"
28#include "FbTk/I18n.hh" 28#include "FbTk/I18n.hh"
29#include "FbTk/StringUtil.hh" 29#include "FbTk/CommandParser.hh"
30 30
31#ifdef HAVE_CONFIG_H 31#ifdef HAVE_CONFIG_H
32#include "config.h" 32#include "config.h"
@@ -239,6 +239,7 @@ int main(int argc, char **argv) {
239 "-rc <string>\t\t\tuse alternate resource file.\n" 239 "-rc <string>\t\t\tuse alternate resource file.\n"
240 "-version\t\t\tdisplay version and exit.\n" 240 "-version\t\t\tdisplay version and exit.\n"
241 "-info\t\t\t\tdisplay some useful information.\n" 241 "-info\t\t\t\tdisplay some useful information.\n"
242 "-list-commands\t\t\tlist all valid key commands.\n"
242 "-log <filename>\t\t\tlog output to file.\n" 243 "-log <filename>\t\t\tlog output to file.\n"
243 "-help\t\t\t\tdisplay this help text and exit.\n\n", 244 "-help\t\t\t\tdisplay this help text and exit.\n\n",
244 245
@@ -248,6 +249,13 @@ int main(int argc, char **argv) {
248 } else if (arg == "-info" || arg == "-i") { 249 } else if (arg == "-info" || arg == "-i") {
249 showInfo(cout); 250 showInfo(cout);
250 exit(EXIT_SUCCESS); 251 exit(EXIT_SUCCESS);
252 } else if (arg == "-list-commands") {
253 FbTk::CommandParser<void>::CreatorMap cmap = FbTk::CommandParser<void>::instance().creatorMap();
254 FbTk::CommandParser<void>::CreatorMap::const_iterator it = cmap.begin();
255 const FbTk::CommandParser<void>::CreatorMap::const_iterator it_end = cmap.end();
256 for (; it != it_end; ++it)
257 cout << it->first << endl;
258 exit(EXIT_SUCCESS);
251 } else if (arg == "-verbose") { 259 } else if (arg == "-verbose") {
252 FbTk::ThemeManager::instance().setVerbose(true); 260 FbTk::ThemeManager::instance().setVerbose(true);
253 } 261 }