Skip to content

createCLISchema

Generated reference page for the createCLISchema function export.

Signatures

ts
function createCLISchema(definition: CLIDefinition): CLISchema;
ParameterTypeDescription
definitionCLIDefinitionProgram name plus optional metadata and commands.

Members

Members

createCLISchema

Create a CLISchema from a plain definition object.

Most consumers should prefer cli(), which returns a CLIBuilder carrying the execution graph. createCLISchema() builds a description only: it normalizes commands recursively through createCommandSchema, so handlers and execution steps are not part of the result and the schema cannot be executed.

Feeding a built schema back in produces a deep-equal schema.

ts
(definition: CLIDefinition): CLISchema;

Examples

ts
const schema = createCLISchema({
  name: 'mycli',
  version: '1.0.0',
  commands: [{ name: 'deploy', flags: { force: { kind: 'boolean' } } }],
});

See Also

Released under the MIT License.