#2121·yargs

[Feature] I would like to generate documentation

Author: benschwarzCreated Jan 27, 2022Updated Sep 25, 2026
Labelsfeature request

I've a CLI that's written using yargs with commandDir subdirectories:

src/
├─ cli.js
└─ cli/
   ├─ site.js
   └─ site/
      ├─ create.js
      └─ list.js

Is it possible to have yargs introspect the CLI and provide command metadata? For example, this might be a list of all commands including:

  • the command and options, e.g: cliname site create [name]
  • help text
  • examples
  • subcommands

I haven't otherwise been able to find an example of how someone would take a yargs CLI and generate documentation for all it's commands. If anyone has an example of that somewhere, please do share :-)