Skip to content

Instantly share code, notes, and snippets.

@ksmithut
Created June 11, 2026 13:02
Show Gist options
  • Select an option

  • Save ksmithut/f605c5175798b6d591c794be01a32839 to your computer and use it in GitHub Desktop.

Select an option

Save ksmithut/f605c5175798b6d591c794be01a32839 to your computer and use it in GitHub Desktop.

citty subcommand runs as well as parent command

To reproduce:

npm install
node index.js test

Note that it prints out both test and main

import { defineCommand, runMain } from "citty";
const main = defineCommand({
run() {
console.log("main");
},
subCommands: {
test: {
run() {
console.log("test");
},
},
},
});
runMain(main);
{
"type": "module",
"dependencies": {
"citty": "^0.2.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment