createCommandSchema
Generated reference page for the createCommandSchema function export.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/schema/command.ts - Source link:
src/core/schema/command.ts:730
Signatures
ts
function createCommandSchema(definition: CommandDefinition): CommandSchema;| Parameter | Type | Description |
|---|---|---|
definition | CommandDefinition | Command name plus optional flags, args, and subcommands. |
Members
Members
createCommandSchema
Create a CommandSchema from a plain definition object.
Most consumers should prefer command(), which returns a CommandBuilder with type inference. createCommandSchema() is the low-level escape hatch for tooling that composes schemas as data.
Flags, args, and subcommands are normalized recursively, so an already-built schema fed back in produces a deep-equal schema.
ts
(definition: CommandDefinition): CommandSchema;Examples
ts
const schema = createCommandSchema({
name: 'deploy',
description: 'Ship the build',
flags: { force: { kind: 'boolean' } },
args: [{ name: 'target', schema: { kind: 'string' } }],
});