diff options
author | Rémi Nicole <nicole@kolabsystems.com> | 2018-08-03 16:59:16 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-08-03 17:10:31 +0200 |
commit | 50bed81038f10091d35c5719df8078612393ae95 (patch) | |
tree | e4a3b634118b2b1b9fd88203902e934299deac9b /sinksh/syntax_modules/sink_trace.cpp | |
parent | ad3dc221273100ba61828f993f1d1c8a1272d665 (diff) | |
download | sink-50bed81038f10091d35c5719df8078612393ae95.tar.gz sink-50bed81038f10091d35c5719df8078612393ae95.zip |
Improve documentation of SinkSH
Summary:
- Add support for positional arguments, options, flags in the syntax tree
- Add automatic generation of usage string
TODO:
- ~~Better document the `--reduce` option in the `list` command~~
- Get the parent command for sub-commands so we could show help for `trace on` and not just `on`
- Pass the syntax to the implementation of the command so commands can easily show help on wrong usage. Also, SyntaxTree could do automatic input validation in the future, this could also help.
- Even with the new documentation, some command could still be confusing. Should we add some usage examples?
Reviewers: cmollekopf
Reviewed By: cmollekopf
Tags: #sink
Differential Revision: https://phabricator.kde.org/D14547
Diffstat (limited to 'sinksh/syntax_modules/sink_trace.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_trace.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sinksh/syntax_modules/sink_trace.cpp b/sinksh/syntax_modules/sink_trace.cpp index ed5e2d8..2811258 100644 --- a/sinksh/syntax_modules/sink_trace.cpp +++ b/sinksh/syntax_modules/sink_trace.cpp | |||
@@ -66,18 +66,17 @@ bool trace(const QStringList &args, State &state) | |||
66 | return traceOn(args, state); | 66 | return traceOn(args, state); |
67 | } | 67 | } |
68 | 68 | ||
69 | |||
70 | Syntax::List syntax() | 69 | Syntax::List syntax() |
71 | { | 70 | { |
72 | Syntax trace("trace", QObject::tr("Control trace debug output."), &SinkTrace::trace, Syntax::NotInteractive); | 71 | Syntax trace("trace", QObject::tr("Control trace debug output."), &SinkTrace::trace, Syntax::NotInteractive); |
73 | trace.completer = &SinkshUtils::debugareaCompleter; | 72 | trace.completer = &SinkshUtils::debugareaCompleter; |
74 | 73 | ||
75 | Syntax traceOff("off", QObject::tr("Turns off trace output."), &SinkTrace::traceOff, Syntax::NotInteractive); | 74 | Syntax traceOff("off", QObject::tr("Turns off trace output."), &SinkTrace::traceOff, Syntax::NotInteractive); |
76 | traceOff.completer = &SinkshUtils::debugareaCompleter; | 75 | traceOff.completer = &SinkshUtils::debugareaCompleter; |
77 | trace.children << traceOff; | 76 | trace.children << traceOff; |
78 | 77 | ||
79 | Syntax traceOn("on", QObject::tr("Turns on trace output."), &SinkTrace::traceOn, Syntax::NotInteractive); | 78 | Syntax traceOn("on", QObject::tr("Turns on trace output."), &SinkTrace::traceOn, Syntax::NotInteractive); |
80 | traceOn.completer = &SinkshUtils::debugareaCompleter; | 79 | traceOn.completer = &SinkshUtils::debugareaCompleter; |
81 | trace.children << traceOn; | 80 | trace.children << traceOn; |
82 | 81 | ||
83 | return Syntax::List() << trace; | 82 | return Syntax::List() << trace; |