@blixis-io/commands
v0.2.4
Published
@Command: command-line commands written as injectable classes. Run with blix run <command>; they get the same DI container as your HTTP app.
Downloads
637
Maintainers
Readme
@blixis-io/commands
Command-line tasks written as injectable classes, run with blix run. They get the same dependency injection as the rest of your app.
blix add runimport { Argument, Command, Option } from "@blixis-io/commands";
@Command({ name: "greet", description: "Greet someone" })
export class GreetCommand {
constructor(private readonly hello: HelloService) {}
run(
@Argument("name", { required: true }) name: string,
@Option("times", { type: "number", default: 1, short: "t" }) times: number,
): void {
for (let i = 0; i < times; i++) console.log(this.hello.greet(name));
}
}blix run # list commands
blix run greet world -t 2
blix run greet --help@blixis-io/core, @blixis-io/di and @blixis-io/cli are peer dependencies.
Part of Blixis Framework — Writing Commands · Reference.
