diff options
Diffstat (limited to 'src/cmd/test.cpp')
-rw-r--r-- | src/cmd/test.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/cmd/test.cpp b/src/cmd/test.cpp new file mode 100644 index 0000000..fc102ff --- /dev/null +++ b/src/cmd/test.cpp @@ -0,0 +1,41 @@ +#include "cmd.hpp" +#include <QCoreApplication> + +int sub_bookmarks(const QStringList &l, QCoreApplication &) +{ + const QCommandLineOption q("q", "something"); + QCommandLineParser parser; + parser.setApplicationDescription("testing bookmarks editor"); + parser.addHelpOption(); + parser.addOption(q); + + if(l.count() <= 1) { + parser.showHelp(); + } + parser.process(l); + return 0; +} + +int sub_list(const QStringList &args, QCoreApplication &) +{ + for(const auto &x : args) { + qDebug("-%s", qUtf8Printable(x)); + } + return 0; +} + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + app.setApplicationName("cmd_test"); + app.setApplicationVersion("0.1.0"); + + const command_line::map<QCoreApplication> m{ + { "bookmarks", &sub_bookmarks }, + { "list", &sub_list } + }; + + const auto f = command_line::process<QCoreApplication>(app, m, "list"); + return f(app); +} + |