You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Sometimes, if our CLI tool get no args, it should work the same as one of it's subCommands, like farm and vite, Vite and Farm both open a development server if no args is given. This works the same as farm dev and vite dev.
Now citty will throw an error if there is no args and run function is not defined for main. But if run function for main is defined, and you're using a subcommand, citty will call the run function defined in main repeatly after called run function defined in subCommand. This confused me, I think it shouldn't call the main handler function when using a subcommand.
Therefore, can we provide a api to setup a default bahavior with no subcommand used?
Such as:
subCommands: {dev,},default: 'dev'
If so, I'd like to work with this issue :)
Additional information
Would you be willing to help implement this feature?
The text was updated successfully, but these errors were encountered:
I think a default subcommand is unnecessary because, without it, the main command would run 👀
Perhaps it's a good idea not to run the run function of the main command when running the sub-command, but compatibility needs to be considered
Describe the feature
Hi! Sometimes, if our CLI tool get no args, it should work the same as one of it's subCommands, like
farm
andvite
, Vite and Farm both open a development server if no args is given. This works the same asfarm dev
andvite dev
.Now
citty
will throw an error if there is no args andrun
function is not defined for main. But ifrun
function for main is defined, and you're using a subcommand,citty
will call therun
function defined in main repeatly after calledrun
function defined in subCommand. This confused me, I think it shouldn't call the main handler function when using a subcommand.Therefore, can we provide a api to setup a default bahavior with no subcommand used?
Such as:
If so, I'd like to work with this issue :)
Additional information
The text was updated successfully, but these errors were encountered: