-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Context.invokeCommands to State.fork
- Loading branch information
Showing
12 changed files
with
226 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { command } from 'src/core/command'; | ||
|
||
/** | ||
* Test Cases: | ||
* | ||
* // Defaults passed to invoked command? | ||
* - DEFAULT, no value, no prompt, no passed value -> no option | ||
* | ||
* // Defaults passed to invoked command? | ||
* - DEFAULT, no value, no prompt, no passed value -> no default | ||
* | ||
* // Parsed values passed to invoked command? | ||
* - No default, VALUE, no prompt, no passed value -> no default | ||
* | ||
* // Prompt updates AND passed to invoked command? | ||
* - No default, no value, PROMPT, no passed value -> no default | ||
* | ||
* // Override passed to invoked command? | ||
* - No default, no value, no prompt, PASSED_VALUE -> no default | ||
* | ||
* | ||
* // Values updated from invoked default? | ||
* - no default, no value, no prompt, no passed value -> DEFAULT | ||
* | ||
* // Default priority? | ||
* - DEFAULT, no value, no prompt, no passed value -> DEFAULT | ||
*/ | ||
|
||
export default command({ | ||
description: 'Get a greeting', | ||
options: { | ||
foo: { | ||
type: 'string', | ||
default: 'default bar', | ||
}, | ||
}, | ||
handler: async ({ options, end }) => { | ||
console.log('------\nBar Values:', options.values, '\n------'); | ||
|
||
end(); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { command } from 'src/core/command'; | ||
import bar from './bar'; | ||
|
||
/** | ||
* Test Cases: | ||
* | ||
* // Defaults passed to invoked command? ✅ | ||
* - DEFAULT, no value, no prompt, no passed value -> no default | ||
* | ||
* // Parsed values passed to invoked command? | ||
* - No default, VALUE, no prompt, no passed value -> no default | ||
* | ||
* // Prompt updates AND passed to invoked command? | ||
* - No default, no value, PROMPT, no passed value -> no default | ||
* | ||
* // Override passed to invoked command? | ||
* - No default, no value, no prompt, PASSED_VALUE -> no default | ||
* | ||
* | ||
* // Values updated from invoked default? | ||
* - no default, no value, no prompt, no passed value -> DEFAULT | ||
* | ||
* // Default priority? | ||
* - DEFAULT, no value, no prompt, no passed value -> DEFAULT | ||
*/ | ||
|
||
export default command({ | ||
description: 'Get a greeting', | ||
options: { | ||
foo: { | ||
type: 'string', | ||
default: 'default foo', | ||
}, | ||
}, | ||
handler: async ({ next, fork, options }) => { | ||
console.log('------\nFoo Values:', options.values, '\n------'); | ||
|
||
const res = await fork({ | ||
commands: [bar], | ||
optionValues: options.values, | ||
}); | ||
|
||
next(res); | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
packages/clide-js/src/cli/commands/hello/[name]/[...things].ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.