command
Generated reference page for the command function export.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/schema/command.ts - Source link:
packages/dreamcli/src/core/schema/command.ts:1423
Signatures
ts
function command(name: string): CommandBuilder;| Parameter | Type | Description |
|---|---|---|
name | string | The command name used for dispatch (e.g. 'deploy'). |
Members
Members
command
Create a new command builder.
ts
(name: string): CommandBuilder;Examples
ts
import { arg, command, flag } from '@kjanat/dreamcli';
const greet = command('greet')
.arg('name', arg.string())
.flag('loud', flag.boolean())
.action(({ args, flags, out }) => {
const msg = `Hello, ${args.name}!`;
out.log(flags.loud ? msg.toUpperCase() : msg);
});Related Examples
- Basic single-command CLI. -
examples/standalone/basic.ts - Interactive prompts with config file fallback. -
examples/standalone/interactive.ts - Mixed machine-readable JSON and human-readable side-channel output. -
examples/standalone/json-mode.ts - Middleware patterns: auth guard, request timing, error handling. -
examples/standalone/middleware.ts - Multi-command CLI with nested command groups (git-like). -
examples/standalone/multi-command.ts - Spinner and progress bar usage. -
examples/standalone/spinner-progress.ts - Testing examples using @kjanat/dreamcli/testkit. -
examples/standalone/testing.ts