Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

snowyu
Copy link

@snowyu snowyu commented Jul 8, 2020

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

@salesforce-cla
Copy link

salesforce-cla bot commented Jul 8, 2020

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

@snowyu snowyu force-pushed the feat/default-command-support branch from 16b76f1 to a3a7850 Compare July 8, 2020 02:07
@snowyu snowyu changed the title feat: supports the default command fallback when command not found (#277) feat: supports the default command fallback when command not found ( resolved #277 ) Jul 8, 2020
@codecov
Copy link

codecov bot commented Jul 8, 2020

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.

@RasPhilCo
Copy link
Contributor

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

@snowyu
Copy link
Author

snowyu commented Jul 25, 2020

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`)

@RasPhilCo
Copy link
Contributor

RasPhilCo commented Aug 3, 2020

You are correct, I misread earlier. See my comment oclif/oclif#277 (comment) 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants