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

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

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

**Header:** `ClikaRT/cli/arg.h`

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.

## Member functions

### help() {#help}

<div class="api-signature">

`Arg&` **`help`**(`std::string_view` `text`)

</div>

The help line shown for this option; chainable.

<div class="api-declared">

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

</div>

### default\_value() {#default_value}

<div class="api-signature">

`Arg&` **`default_value`**(`std::string_view` `value`)

</div>

Value used when the option is absent (parsed from this text at the option's declared type).

<div class="api-declared">

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

</div>

### implicit\_value() {#implicit_value}

<div class="api-signature">

`Arg&` **`implicit_value`**(`std::string_view` `value`)

</div>

Value used when the option is given with no argument (e.g. `--jobs`).

<div class="api-declared">

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

</div>

### required() {#required}

<div class="api-signature">

`Arg&` **`required`**(`bool` `v` `=` `true`)

</div>

Mark required; parsing fails when the option is absent; chainable.

<div class="api-declared">

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

</div>

### metavar() {#metavar}

<div class="api-signature">

`Arg&` **`metavar`**(`std::string_view` `name`)

</div>

The value placeholder shown in usage (e.g. `PATH`); chainable.

<div class="api-declared">

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

</div>

### env() {#env}

<div class="api-signature">

`Arg&` **`env`**(`std::string_view` `name`)

</div>

Environment variable consulted when the option is absent from argv.

<div class="api-declared">

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

</div>

### multiple() {#multiple}

<div class="api-signature">

`Arg&` **`multiple`**(`bool` `v` `=` `true`)

</div>

Accept the option more than once (collect all occurrences).

<div class="api-declared">

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

</div>

### delimiter() {#delimiter}

<div class="api-signature">

`Arg&` **`delimiter`**(`char` `d`)

</div>

Split a single argument into several values on `d` (e.g. `-I a,b,c`).

<div class="api-declared">

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

</div>

### choices() {#choices}

<div class="api-signature">

`Arg&` **`choices`**(`std::initializer_list<std::string_view>` `values`)

</div>

Restrict accepted values to this set (compared at the declared type).

<div class="api-declared">

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

</div>

### conflicts\_with() {#conflicts_with}

<div class="api-signature">

`Arg&` **`conflicts_with`**(`std::string_view` `other`)

</div>

Mutual exclusion with option `other`; both present is a usage error.

<div class="api-declared">

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

</div>

### needs() {#needs}

<div class="api-signature">

`Arg&` **`needs`**(`std::string_view` `other`)

</div>

Require option `other` whenever this one is present.

<div class="api-declared">

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

</div>

### hidden() {#hidden}

<div class="api-signature">

`Arg&` **`hidden`**(`bool` `v` `=` `true`)

</div>

Hide from help/usage (still parsed); chainable.

<div class="api-declared">

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

</div>

### alias() {#alias}

<div class="api-signature">

`Arg&` **`alias`**(`std::string_view` `name`)

</div>

An additional accepted spelling; chainable.

<div class="api-declared">

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

</div>

### validator() {#validator}

<div class="api-signature">

`Arg&` **`validator`**([`Validator`](./index.md#Validator) `fn`)

</div>

Reject values your callback disapproves of (e.g. a numeric range, a format). Runs after type-parsing and [`choices`](./Arg.md#choices). A throwing validator is contained caller-side (see detail::contain) and becomes a failure. An empty validator clears the one set before, so every value passes it.

<div class="api-declared">

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

</div>
