Built-in Commands¶
Registered in every Terminal by registerBuiltins(). Cannot be removed (but can be shadowed).
help — Show help¶
HelpCommand. Renders usage from the command tree at runtime.
Use --command <name> or just <name> to scope help:
The positional shorthand works the same way:
Subcommands are listed in a table:
> help --command config
config - Configuration commands
Arguments:
--file Config file
Subcommands:
get Get a config value
set Set a config value
Nested subcommands are resolved by walking the command tree:
Multiple levels of nesting are supported:
Quoted paths with --command work the same way:
Unknown command:
exit — Exit¶
ExitCommand. Calls ctx.exit() → ctx.terminal.stop().
clear — Clear screen¶
ClearCommand. Writes \x1Bc (ANSI form-feed) to stdout.
Shadowing¶
Register a command with the same name to override a builtin:
class SafeExit extends Command {
constructor() {
super('exit', 'Exit with confirmation');
}
async execute(ctx: CommandContext, _args: CommandArguments): Promise<void> {
ctx.stdout.write('Are you sure? (y/N) ');
// read ctx.stdin, then ctx.exit()
}
}
terminal.register(new SafeExit());
Commands — defining commands and arguments