@sirian/console
v7.1.7
Published
The Console component allows you to create command-line commands
Downloads
241
Maintainers
Readme
Console
Install
npm install @sirian/console
Example
import {Application, Argument, Command, CommandDefinition} from "@sirian/console";
class HelloCommand extends Command {
static configure(definition: CommandDefinition) {
definition
.setDescription("Simple command example")
.setArguments({
name: new Argument({
defaultValue: "Nobody",
required: false,
}),
});
}
execute() {
const io = this.io;
const name = io.input.getArgument("name");
io.success("Great, you did it!");
io.writeln(`Hello <info>${name}</info>!`);
}
}
const app = new Application({
name: "Example",
commands: [
HelloCommand
]
});
app.run();