@usage-spec/oclif
v1.1.0
Published
Generates usage spec for CLIs written with oclif
Maintainers
Readme
@usage-spec/oclif
Generates usage spec for CLIs built with oclif.
Install
npm install @usage-spec/oclifUsage
import { Config } from "@oclif/core";
import { generate } from "@usage-spec/oclif";
const config = await Config.load();
console.log(generate(config));API
generate(config)
Generates a usage spec in KDL format from an oclif Config object.
generateKDL(config)
Alias for generate().
generateJSON(config)
Generates a usage spec in JSON format.
convertRoot(config)
Converts an oclif Config to the Spec data structure.
Notes
The converter accepts a plain object matching the OclifConfig interface, so you can pass config.commands, config.topics, etc. directly from an oclif Config instance without depending on @oclif/core at compile time.
Command IDs with : separators are automatically organized into nested cmd structures. Topic descriptions are used for intermediate group nodes.
License
MIT
