improve required message

This commit is contained in:
Chen Asraf
2021-07-29 22:40:50 +03:00
parent aa595f8bbc
commit 654b85ae32

View File

@@ -3,7 +3,11 @@ export class RequiredError extends Error {
cmdName!: string
constructor(fieldName: string, cmdName: string) {
super(`${fieldName} is required, but was not defined` + (cmdName !== "all" ? ` for ${cmdName}` : ""))
super(
`Option: \`${fieldName}\` is required${
cmdName !== "all" ? ` for command: \`${cmdName}\`` : ""
}, but was not defined. Try using: \`--${fieldName} {value}\``
)
this.fieldName = fieldName
this.cmdName = cmdName
}