App Configurations
You can also provide global-level configuration for Mustard.
allowUnknownOptions
: Allow unknown options to be passed to the command. If this is set tofalse
, Mustard will throw an error when it encounters an unknown option during parse stage.enableUsage
: Allow Mustard to generate usage information for commands when--help
or-h
option is passed. You can also specify a custom usage generator:
@App({
name: "my-mustard-app",
configurations: {
enableUsage: (command: CommandRegistryPayload) => `Help info for ${command.commandInvokeName}.`
},
})
class Project implements MustardApp {
onStart() {}
onComplete() {}
}
enableVersion
: Allow Mustard to generate version information for commands when--version
or-v
option is passed. You can also specify a custom version string.
@App({
name: "my-mustard-app",
configurations: {
enableVersion: require(path.resolve("./package.json")).version,
},
})
class Project implements MustardApp { }
ignoreValidationErrors
: Ignore validation errors when parsing options. If this is set tofalse
, Mustard will throw an error when it encounters a validation error during parse stage.lifeCycles
: Specify the life cycle of the command. Mustard will execute the corresponding life cycle function when the command is executed. You can also specify a custom life cycle function.
@App({
name: "my-mustard-app",
configurations: {
lifeCycles: {
onStart() {}
onError(error) {}
onComplete() {}
}
},
})
class Project implements MustardApp { }
This is equivalent to:
@App({
name: "my-mustard-app",
configurations: { },
})
class Project implements MustardApp {
onStart() {}
onError(error) {}
onComplete() {}
}