Kind: Function
Source: lib/argument.js
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
tsfunction humanReadableArgName(arg)
Parameters
| Name | Type |
|---|---|
arg | any |
Diagram
mermaidgraph LR A[Argument instance] --> B[name()] A --> C[required and variadic flags] B --> D[humanReadableArgName] C --> D D --> E[Help usage label]
Usage
jsimport { 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
Argumentobject withname(),required, andvariadicvalues; 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:14Help—lib/help.js:13
Was this page helpful?