CPGen
C++ project generator
Loading...
Searching...
No Matches
Classes | Typedefs
CLI.hpp File Reference

Command-line argument parser that produces a typed project configuration. More...

#include "CPGen/Core/Config.hpp"
#include <variant>
Include dependency graph for CLI.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CLI
 Stateful command-line parser that converts argv into a Config. More...
 

Typedefs

using Config = std::variant< ProjectConfig, bool >
 Result type of CLI::parse.
 

Detailed Description

Command-line argument parser that produces a typed project configuration.

Author
Darleanow
Version
1.0.1

Typical usage:

CLI cli;
auto cfg = cli.parse(argc, argv);
if (std::holds_alternative<ProjectConfig>(cfg)) {
// non-interactive generation path
} else {
// launch TUI
}
Stateful command-line parser that converts argv into a Config.
Definition CLI.hpp:58
Config parse(int argc, char **argv)
Parse command-line arguments into a typed configuration.
Definition CLI.cpp:58

Typedef Documentation

◆ Config

Result type of CLI::parse.

  • ProjectConfig — when the user supplied project flags; the caller should run the resolver and generators immediately.
  • bool (true) — when -u / --tui was supplied; the caller should launch the interactive TUI instead.