---
title: "ClikaRT::cli::App"
sidebar_label: "App"
description: "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."
---

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

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

**Header:** `ClikaRT/cli/command.h`  
**Inherits:** [`ClikaRT::cli::Command`](./Command.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.

## Member functions

### App(string\_view, string\_view) {#App}

<div class="api-signature">

`explicit` **`App`**(`std::string_view` `program`, `std::string_view` `description` `=` `{}`)

</div>

The root app: [`program`](./App.md#program) is the display name in usage/help; `description` heads the help text.

<div class="api-declared">

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

</div>

### App(App) {#App-2}

<div class="api-signature">

**`App`**(`App&&`) `noexcept`

</div>

Move-only: transfers the app.

<div class="api-declared">

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

</div>

### operator=(App) {#operator-assign}

<div class="api-signature">

[`App`](./App.md)`&` **`operator=`**([`App`](./App.md)`&&`) `noexcept`

</div>

Move-assign: transfers the app.

<div class="api-declared">

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

</div>

### App(App) {#App-3}

<div class="api-signature">

**`App`**(`const App&`) `=delete`

</div>

<div class="api-declared">

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

</div>

### operator=(App) {#operator-assign-2}

<div class="api-signature">

[`App`](./App.md)`&` **`operator=`**(`const` [`App`](./App.md)`&`) `=delete`

</div>

<div class="api-declared">

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

</div>

### \~App() {#App-4}

<div class="api-signature">

**`~App`**()

</div>

Releases the app.

<div class="api-declared">

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

</div>

### version() {#version}

<div class="api-signature">

[`App`](./App.md)`&` **`version`**(`std::string_view` `v`)

</div>

The text `--`[`version`](./App.md#version) prints; chainable.

<div class="api-declared">

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

</div>

### allow\_unknown() {#allow_unknown}

<div class="api-signature">

[`App`](./App.md)`&` **`allow_unknown`**(`bool` `v` `=` `true`)

</div>

collect unknown options instead of erroring

<div class="api-declared">

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

</div>

### wrap\_width() {#wrap_width}

<div class="api-signature">

[`App`](./App.md)`&` **`wrap_width`**(`int` `columns`)

</div>

override the help wrap width

<div class="api-declared">

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

</div>

### output() {#output}

<div class="api-signature">

[`App`](./App.md)`&` **`output`**(`std::ostream&` `os`)

</div>

where [run()](./App.md#run) prints help/version (default std::cout)

<div class="api-declared">

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

</div>

### errors() {#errors}

<div class="api-signature">

[`App`](./App.md)`&` **`errors`**(`std::ostream&` `os`)

</div>

where [run()](./App.md#run) prints errors (default std::cerr)

<div class="api-declared">

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

</div>

### enable\_completion() {#enable_completion}

<div class="api-signature">

[`App`](./App.md)`&` **`enable_completion`**()

</div>

register the hidden `completion <shell>` subcommand

<div class="api-declared">

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

</div>

### parse() {#parse}

<div class="api-signature">

[`Args`](./Args.md) **`parse`**(`int` `argc`, `const char*const*` `argv`)

</div>

Parse argv; never prints, never exits, never mutates argv. On a usage error returns a failure [`Result`](../Result.md); sets help\_requested()/version\_requested() on the result rather than acting on them.

<div class="api-declared">

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

</div>

### run() {#run}

<div class="api-signature">

`int` **`run`**(`int` `argc`, `const char*const*` `argv`)

</div>

Parse, then print help/version/errors to the configured streams and dispatch to the matched handler. Returns the handler's exit code, 0 for help/version, or 2 on a usage error. A handler's failure [`Result`](../Result.md), including a throw contained by `detail::contain`, raises [`ClikaRT::Error`](../Error.md) (caller-side, like every fallible call).

<div class="api-declared">

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

</div>

### help\_text() {#help_text}

<div class="api-signature">

`std::string` **`help_text`**() `const`

</div>

full help for the root command

<div class="api-declared">

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

</div>

### help\_text(vector\<string\>) {#help_text-2}

<div class="api-signature">

`std::string` **`help_text`**(`const std::vector<std::string>&` `subcommand_path`) `const`

</div>

Full help for the subcommand named by `subcommand_path` (each element the name of a subcommand at the next level down); falls back to root help if the path names no known subcommand.

<div class="api-declared">

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

</div>

### usage\_line() {#usage_line}

<div class="api-signature">

`std::string` **`usage_line`**() `const`

</div>

the one-line usage synopsis

<div class="api-declared">

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

</div>

### version\_string() {#version_string}

<div class="api-signature">

`std::string` **`version_string`**() `const`

</div>

the `--`[`version`](./App.md#version) text

<div class="api-declared">

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

</div>

### completion\_script() {#completion_script}

<div class="api-signature">

`std::string` **`completion_script`**([`Shell`](./index.md#Shell) `shell`) `const`

</div>

A completion script for `shell`; source it in the shell's rc.

<div class="api-declared">

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

</div>

### program() {#program}

<div class="api-signature">

`std::string_view` **`program`**() `const`

</div>

the program display name

<div class="api-declared">

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

</div>
