config icon indicating copy to clipboard operation
config copied to clipboard

feat: supports the default command fallback when command not found ( resolved #277 )

Open snowyu opened this issue 5 years ago • 5 comments

add an alias 'default' to set a default command.

snowyu avatar Jul 08 '20 02:07 snowyu

Thanks for the contribution! Before we can merge this, we need @snowyu to sign the Salesforce.com Contributor License Agreement.

salesforce-cla[bot] avatar Jul 08 '20 02:07 salesforce-cla[bot]

Codecov Report

Merging #139 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #139   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           2       2           
  Lines          12      12           
  Branches        3       3           
======================================
  Misses         12      12           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update db13f7e...a3a7850. Read the comment docs.

codecov[bot] avatar Jul 08 '20 02:07 codecov[bot]

You should do this with the command_not_found hook https://oclif.io/docs/hooks

RasPhilCo avatar Jul 24 '20 23:07 RasPhilCo

command_not_found can not do this operation unless it accepts a new command return and do not throw exception:

    if (!c) {
		      await this.runHook('command_not_found', {id})
		      throw new CLIError(`command ${id} not found`)

snowyu avatar Jul 25 '20 02:07 snowyu

You are correct, I misread earlier. See my comment https://github.com/oclif/oclif/issues/277#issuecomment-668271675 on adding a root index command. Thanks for the PR on this! I really don't like to not use your efforts, but this particular solution was an edge case that was easier for me to write than explain.

RasPhilCo avatar Aug 03 '20 22:08 RasPhilCo