Support `createMain(command)` return value from `run` method
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Description
Describe the feature
import { createMain, defineCommand } from 'citty'
const command = defineCommand({
//...
async run() {
return Promise.resolve("hello")
}
})
const apiCommand = createMain(_rDefault(command))
const value = await apiCommand({
rawArgs: []
})
console.log(value) //=> "hello"
Additional information
- Would you be willing to help implement this feature?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing createMain and how it invokes a command's run method. Check how the returned value is currently handled, then verify that awaiting the created API command with rawArgs: [] produces the value returned by run, such as "hello".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100