-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
Describe the feature
Add defs in defineCommand function like interceptors or middlewares
example:
const customInterceptor1 = (ctx: CommandContext) => false
const customInterceptor2 = (ctx: CommandContext) => console.log('before run.')
defineCommand({
meta: {
name: "hello",
version: "1.0.0",
description: "My Awesome CLI App",
},
interceptors: [customInterceptor1, customInterceptor2]
run({ args }) {
// output: before run.
// and this code will not be execute
console.log(`${args.friendly ? "Hi" : "Greetings"} ${args.name}!`);
},
})Additional information
- Would you be willing to help implement this feature?
Metadata
Metadata
Assignees
Labels
No labels