[READ-ONLY] Mirror of https://github.com/bombshell-dev/tab. shell autocompletions for javascript CLIs
4

Configure Feed

Select the types of activity you want to include in your feed.

fix(citty-adapter): dont throw an error when there is no subcommand (#74)

authored by

AmirHossein Sakhravi and committed by
GitHub
(Oct 16, 2025, 1:14 PM +0330) 5f929c49 9aa80ef3

+17 -9
+5
.changeset/busy-clocks-serve.md
··· 1 + --- 2 + '@bomb.sh/tab': patch 3 + --- 4 + 5 + fix: citty should not throw an error when there is no subcommand
+12 -9
src/citty.ts
··· 127 127 } 128 128 129 129 const subCommands = await resolve(instance.subCommands); 130 - if (!subCommands) { 131 - throw new Error('Invalid or missing subCommands.'); 132 - } 133 130 134 131 const isPositional = isConfigPositional(instance); 135 132 ··· 149 146 } 150 147 } 151 148 152 - await handleSubCommands( 153 - subCommands, 154 - undefined, 155 - completionConfig?.subCommands 156 - ); 149 + if (subCommands) { 150 + await handleSubCommands( 151 + subCommands, 152 + undefined, 153 + completionConfig?.subCommands 154 + ); 155 + } 157 156 158 157 if (instance.args) { 159 158 for (const [argName, argConfig] of Object.entries(instance.args)) { ··· 243 242 }, 244 243 }); 245 244 246 - subCommands.complete = completeCommand; 245 + if (!subCommands) { 246 + instance.subCommands = { complete: completeCommand }; 247 + } else { 248 + subCommands.complete = completeCommand; 249 + } 247 250 248 251 return t; 249 252 }