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_sync.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_sync.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_sync.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sinksh/syntax_modules/sink_sync.cpp b/sinksh/syntax_modules/sink_sync.cpp index f165f58..e13e8f8 100644 --- a/sinksh/syntax_modules/sink_sync.cpp +++ b/sinksh/syntax_modules/sink_sync.cpp | |||
@@ -83,6 +83,11 @@ bool sync(const QStringList &args, State &state) | |||
83 | Syntax::List syntax() | 83 | Syntax::List syntax() |
84 | { | 84 | { |
85 | Syntax sync("sync", QObject::tr("Synchronizes a resource."), &SinkSync::sync, Syntax::EventDriven); | 85 | Syntax sync("sync", QObject::tr("Synchronizes a resource."), &SinkSync::sync, Syntax::EventDriven); |
86 | |||
87 | sync.addPositionalArgument({ .name = "type", .help = "The type of resource to synchronize" }); | ||
88 | sync.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource to synchronize" }); | ||
89 | sync.addParameter("password", { .name = "password", .help = "The password of the resource", .required = true }); | ||
90 | |||
86 | sync.completer = &SinkshUtils::resourceCompleter; | 91 | sync.completer = &SinkshUtils::resourceCompleter; |
87 | 92 | ||
88 | return Syntax::List() << sync; | 93 | return Syntax::List() << sync; |