How to: Flag whose presence disables validation (like --help) #1288
-
Hey, I'm trying to add a flag that behaves like --help in regards to how its presence disables validation of input. How can this be achieved? Note: I am aware of https://github.com/salesforcecli/cli/blob/main/src/hooks/preparse.ts |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I am trying the import {Hook} from '@oclif/core'
const hook: Hook<'prerun'> = async function (opts) {
console.log(opts.Command) // undefined
}
export default hook |
Beta Was this translation helpful? Give feedback.
-
We can override command |
Beta Was this translation helpful? Give feedback.
We can override command
init
method. We already were, and were running parse there, but I didn't know that until now. Not sure ifinit
by default does a parse too, or that's just because of our logic. Anyways, either way,init
method overriding is the solution in my case.