Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::Cli::anonymous_namespace{arguments.cpp} Namespace Reference

Functions

qsizetype textWidth ()
 How wide argparse makes its text: $COLUMNS (else 80), less 2.
QStringList usageLines (const QStringList &parts, const QString &indent, const QString &prefix)
 parts in lines of at most textWidth(), each line after the first starting with indent; the first starts after prefix, which isn't included.
QString usage (const ArgumentSpec &spec)
 The usage of spec, wrapped as argparse wraps it.
QString matchFlag (const ArgumentSpec &spec, const QString &arg)
 The flag of spec that arg names, in full or abbreviated, or an empty string for none.
const ValueOption * valueOption (const ArgumentSpec &spec, const QString &name)
 The option of spec named name that takes a value, or nothing.
bool isNegativeNumber (const QString &arg)
 Whether arg looks like a negative number, which argparse takes as a value.
const ValueOption * attachedShortOption (const ArgumentSpec &spec, const QString &arg)
 The option of spec with its value attached to arg ("-n5"), or nothing.
QString checkedValue (const ArgumentSpec &spec, const ValueOption &option, const QString &value)
 value checked as option's: an integer, if it must be one.
bool takeOption (const ArgumentSpec &spec, const QStringList &args, qsizetype &i, Arguments &out)
 Reads the option at i in args into out, and its value, which may be the next argument (then i moves to it).

Function Documentation

◆ matchFlag()

QString Sonde::Cli::anonymous_namespace{arguments.cpp}::matchFlag ( const ArgumentSpec & spec,
const QString & arg )

The flag of spec that arg names, in full or abbreviated, or an empty string for none.

Fails if it is ambiguous.

◆ takeOption()

bool Sonde::Cli::anonymous_namespace{arguments.cpp}::takeOption ( const ArgumentSpec & spec,
const QStringList & args,
qsizetype & i,
Arguments & out )

Reads the option at i in args into out, and its value, which may be the next argument (then i moves to it).

Prints the help and exits for -h.

Returns
Whether spec has the option.

◆ usageLines()

QStringList Sonde::Cli::anonymous_namespace{arguments.cpp}::usageLines ( const QStringList & parts,
const QString & indent,
const QString & prefix )

parts in lines of at most textWidth(), each line after the first starting with indent; the first starts after prefix, which isn't included.

As argparse's usage formatter does it.