Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
commands.h
Go to the documentation of this file.
1#pragma once
2
7
8#include "arguments.h"
9
10#include <QtCore/QHash>
11#include <QtCore/QList>
12#include <QtCore/QString>
13#include <QtCore/QStringList>
14
15namespace Sonde::Cli {
16
26
28struct FormDoc
29{
30 QString synopsis;
31 QString summary;
32};
33
36{
37 QString name;
38 QString group;
39 QList<FormDoc> forms;
42 QStringList choices;
43 QHash<QString, Completion> optionCompletion;
44 QString details;
45};
46
55
58{
59 QString manSection;
60 QString text;
61};
62
64const QList<CommandDoc> &commands();
66const CommandDoc *command(const QString &name);
68const QList<GlobalOptionDoc> &globalOptions();
70const QList<TopicDoc> &topics();
72const QList<std::pair<QString, QString>> &environment();
74const QList<std::pair<QString, QString>> &examples();
76QString usageText();
77
78} // namespace Sonde::Cli
A command's options read as Python's argparse read them in the Python sonde: flags (abbreviated if un...
const CommandDoc * command(const QString &name)
The command called name, or nullptr.
Definition commands.cpp:314
const QList< TopicDoc > & topics()
The prose sections, in order.
Definition commands.cpp:344
QString usageText()
What sonde --help prints.
Definition commands.cpp:403
const QList< std::pair< QString, QString > > & examples()
A few examples for the man page: the command line, and what it does.
Definition commands.cpp:385
const QList< GlobalOptionDoc > & globalOptions()
The options before the command.
Definition commands.cpp:323
const QList< std::pair< QString, QString > > & environment()
The environment variables sonde reads or sets: name and what it is for.
Definition commands.cpp:367
const QList< CommandDoc > & commands()
The commands, in the order –help lists them.
Definition commands.cpp:308
Completion
What a value or an argument completes to in the shell.
Definition commands.h:18
@ Container
A running container, auto, or a docker ps filter.
Definition commands.h:23
@ Template
A template or component in the libraries.
Definition commands.h:22
@ None
Nothing.
Definition commands.h:19
@ Choices
One of a fixed list (CommandDoc::choices).
Definition commands.h:24
@ Path
A file or directory.
Definition commands.h:20
@ Tool
A tool of the running application.
Definition commands.h:21
What a command accepts.
Definition arguments.h:28
One of sonde's commands.
Definition commands.h:36
QList< FormDoc > forms
Its lines in –help, in order.
Definition commands.h:39
QString name
The word after "sonde": "trust"; "--version" for the option.
Definition commands.h:37
QStringList choices
With Completion::Choices: the choices.
Definition commands.h:42
Completion positional
What its arguments complete to.
Definition commands.h:41
QString details
More for the man page, if any; paragraphs separated by blank lines.
Definition commands.h:44
QHash< QString, Completion > optionCompletion
What each value option completes to.
Definition commands.h:43
ArgumentSpec spec
Its flags, options and arguments, for -h and parsing.
Definition commands.h:40
QString group
The –help group it is listed in; empty for the ungrouped ones.
Definition commands.h:38
One line of --help for a command: how it is called, and what it does.
Definition commands.h:29
QString summary
What it does, in a few words; wrapped by –help.
Definition commands.h:31
QString synopsis
After "sonde ": "log [-n N]".
Definition commands.h:30
An option that comes before the command, such as –config.
Definition commands.h:49
QString help
What it does.
Definition commands.h:52
QString name
"--config".
Definition commands.h:50
QString metavar
"PATH".
Definition commands.h:51
Completion completion
What its value completes to.
Definition commands.h:53
A section of prose: in –help after the commands, and in the man page.
Definition commands.h:58
QString text
The text as –help prints it: lines, indented where it shows code.
Definition commands.h:60
QString manSection
The man page section it goes in: "FILES", "CONFIGURATION".
Definition commands.h:59