---
title: "ClikaRT::cli"
sidebar_label: "cli"
description: "Namespace ClikaRT::cli"
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--namespace">namespace</span>

## Classes

| Name | Description |
| --- | --- |
| [`App`](./App.md) | The application root: a command plus the parse/run entry points, version, help/usage/completion text, and injectable output/error streams. Owns the parser; move-only. |
| [`Arg`](./Arg.md) | A typed option or positional handle. Fluent setters return `*this`; each configures the underlying declared option through the parser. Non-owning; valid while the owning [`App`](./App.md) lives. |
| [`Args`](./Args.md) | The parsed result. Typed reads re-parse the retained token, so the read type is independent of how the option was declared; a wrong-category read returns a failure [`Result`](../Result.md). Owns its state; move-only. Valid while the owning [`App`](./App.md) lives (it references the matched command). |
| [`Command`](./Command.md) | A node in the command tree. Owns nothing itself (a non-owning handle into the [`App`](./App.md)); declares typed options / positionals / flags / subcommands. Options declared on an ancestor resolve from any descendant. |
| [`ExclusiveGroup`](./ExclusiveGroup.md) | A mutually-exclusive constraint. Lightweight handle, valid while its [`App`](./App.md) lives. |
| [`Flag`](./Flag.md) | A boolean switch (carries no value). `count()` on the parsed [`Args`](./Args.md) supports `-vvv`. Non-owning handle, valid while the owning [`App`](./App.md) lives. |
| [`Group`](./Group.md) | A display-only help section. Lightweight handle, valid while its [`App`](./App.md) lives. |

## Enumerations

### enum ArgType {#ArgType}

<div class="api-signature">

`enum class` **`ArgType`**

</div>

The value type of an option, fixed where it is declared. One value per parse type: String (verbatim), Int, Float, Bool.

| Enumerator | Description |
| --- | --- |
| `String` |  |
| `Int` |  |
| `Float` |  |
| `Bool` |  |

<div class="api-declared">

Declared in `ClikaRT/cli/arg.h`, line 41

</div>

### enum Shell {#Shell}

<div class="api-signature">

`enum class` **`Shell`**

</div>

Shells [`App::completion_script`](./App.md#completion_script) can emit.

| Enumerator | Description |
| --- | --- |
| `Bash` |  |
| `Zsh` |  |
| `Fish` |  |

<div class="api-declared">

Declared in `ClikaRT/cli/arg.h`, line 44

</div>

## Type aliases

### using Validator {#Validator}

<div class="api-signature">

`using` **`Validator`** `=` `std::function<`[`Result`](../Result.md)`<void>(std::string_view value)>`

</div>

A custom validation callback for an option's value. It runs after the value is parsed at the option's declared type and after `choices`: given the value as text, return [`Result`](../Result.md)`<void>`; `ok()` accepts it, a failure rejects the parse and its message is surfaced to the user.

<div class="api-declared">

Declared in `ClikaRT/cli/arg.h`, line 50

</div>

### using CommandHandler {#CommandHandler}

<div class="api-signature">

`using` **`CommandHandler`** `=` `std::function<`[`Result`](../Result.md)`<int>(`[`Args`](./Args.md) `&)>`

</div>

A subcommand handler: receives the parsed args, returns a process exit code.

<div class="api-declared">

Declared in `ClikaRT/cli/command.h`, line 40

</div>

## `ClikaRT/cli/arg.h` {#arg-h}

```cpp
#include <ClikaRT/cli/arg.h>
```

Typed arguments and the parsed-result view for the command-line parser.

An option's type is chosen where it is declared, via `ArgType` (String / Int / Float / Bool). Values cross the library boundary as strings (defaults, choices, and the parsed tokens are all text), and typed reads come back as `Result<T>` (`Args::get_int` / `get_float` / `get_bool` / `get_string`). This keeps the public ABI free of templates and matches the parser's own store-raw-string / re-parse-on-read model.

`Arg` and `Flag` are lightweight, non-owning handles: the parser owns the declared option; the handle just names it for fluent configuration and is valid while its owning `App` lives.

## `ClikaRT/cli/command.h` {#command-h}

```cpp
#include <ClikaRT/cli/command.h>
```

The command / application surface: `Command` (a node in the command tree), the group handles `Group` (display-only) and `ExclusiveGroup` (mutually-exclusive constraint), and `App` (the root: parse/run, version, help, completion). Every fallible call returns `Result` and the parser never throws or exits.

```cpp
cli::App app("clikart-cli", "the model zoo");
app.version("0.1");
app.flag("-v", "--verbose").help("chatty");
app.add("--revision", cli::ArgType::String).default_value("main");
app.positional("source", cli::ArgType::String);
int rc = app.run(argc, argv);
```
