Skip to content

command

Generated reference page for the command function export.

Signatures

ts
function command(name: string): CommandBuilder;
ParameterTypeDescription
namestringThe 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);
  });

See Also

Released under the MIT License.