morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
args.hpp File Reference

The generic client's command line: which source it opens and how it starts. Spec 4 §3. More...

#include <expected>
#include <optional>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  morph::client::Args
 What the generic client reads from its command line. More...

Functions

std::expected< Args, std::string > morph::client::readArgs (std::vector< std::string > &args)
 Reads the client's options from args and removes them, leaving the rest for the frontend.

Detailed Description

The generic client's command line: which source it opens and how it starts. Spec 4 §3.

Specified in docs/spec/client/client.md.

Definition in file args.hpp.

Function Documentation

◆ readArgs()

std::expected< Args, std::string > morph::client::readArgs ( std::vector< std::string > & args)
nodiscard

Reads the client's options from args and removes them, leaving the rest for the frontend.

Each value option is --name value or --name=value, and the last one given wins. args[0] is the program name, and nothing after a -- is read.

Parameters
argsThe command line; what was read is removed.
Returns
The options, or why they are refused: a value option without its value, or not exactly one of --server and --app. args is unchanged on a refusal.