# humanReadableArgName

**Kind:** Function

**Source:** [`lib/argument.js`](https://github.com/tj/commander.js/blob/main/lib/argument.js#L143)

Takes an argument and returns its human readable equivalent for help usage.

`humanReadableArgName` converts an `Argument` instance into the text shown in command help. It reads the argument name, required state, and variadic state to preserve CLI syntax such as angle brackets, square brackets, and trailing ellipses.

## Signature

```ts
function humanReadableArgName(arg)
```

## Parameters

| Name | Type |
|---|---|
| `arg` | `any` |

## Diagram

```mermaid
graph LR
  A[Argument instance] --> B[name()]
  A --> C[required and variadic flags]
  B --> D[humanReadableArgName]
  C --> D
  D --> E[Help usage label]
```

## Usage

```js
import { Argument, humanReadableArgName } from './lib/argument.js';

const requiredArgument = new Argument('<source>');
const optionalVariadicArgument = new Argument('[files...]');

console.log(humanReadableArgName(requiredArgument));
// <source>

console.log(humanReadableArgName(optionalVariadicArgument));
// [files...]
```

## AI Coding Instructions

- Pass an `Argument` object with `name()`, `required`, and `variadic` values; do not pass a raw string.
- Keep output formatting aligned with command syntax: required arguments use `<...>` and optional arguments use `[...]`.
- Preserve the `...` suffix for variadic arguments so help output matches parser behavior.
- Call this function during help or usage rendering, not during argument parsing or validation.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (2)

- `Command` — `lib/command.js`:14
- `Help` — `lib/help.js`:13
