-
Notifications
You must be signed in to change notification settings - Fork 20
/
hello.ts
33 lines (31 loc) 路 744 Bytes
/
hello.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import consola from "consola";
import { defineCommand, createMain } from "../src";
const command = defineCommand({
meta: {
name: "hello",
version: "1.0.0",
description: "My Awesome CLI App",
},
args: {
name: {
type: "positional",
description: "Your name",
required: true,
},
friendly: {
type: "boolean",
description: "Use friendly greeting",
},
adjective: {
type: "enum",
description: "Adjective to use in greeting",
options: ["awesome", "cool", "nice"],
default: "awesome",
require: false,
}
},
run({ args }) {
consola.log(`${args.friendly ? "Hi" : "Greetings"} ${args.adjective} ${args.name}!`);
},
});
createMain(command)({});