oclif

How to force --help command to execute in run method in Oclif


My requirement is quite simple. I want to execute help command when a user executes a specific command without enough arguments.

async run() { if (!args.name) { this.log(please provide a project name.) // help ()
} }


Solution

  • After some documentation searching, I found the answer:

    if (!args.name) {
          this.log(`please provide a project name.`)
          **await Build.run(['--help'])**   
    }