Skip to content

feat: allow spaces in CLI name for help output#42

Open
Rugvip wants to merge 1 commit intoprivatenumber:masterfrom
Rugvip:rugvip/multi-word-commands
Open

feat: allow spaces in CLI name for help output#42
Rugvip wants to merge 1 commit intoprivatenumber:masterfrom
Rugvip:rugvip/multi-word-commands

Conversation

@Rugvip
Copy link

@Rugvip Rugvip commented Mar 6, 2026

Hello @privatenumber πŸ‘‹, same context as privatenumber/type-flag#52

I'm wondering if this is a change you're open to. It relaxes the restriction on top-level CLI naming to allow spaces within the name. Our use-case is separation of the command hierarchy and individual definitions. The command implementations only parse the args provided to the command using cleye, rather than the full process argv slice. There's a different layer that handles the command routing.

The benefit of this change is that we can rely on the built-in usage generation in cleye, rather than needing to redefine it. For example, the following:

cli({
  help: { description: ..., usage: 'my-cli repo test [flags...] <path>' },
  parameters: ['<path>'],
  flags: ...,
}, undefined, args)

Can be switched to this:

cli({
  name: 'my-cli repo test',
  help: { description: ... },
  parameters: ['<path>'],
  flags: ...,
}, undefined, args) // side note - open to an (options, args) overload? πŸ˜‰ 

I was about to add a condition that restricts this to only be allowed if the commands option is not present, but realized that it might still be useful to allow this at the top level, but keep the restriction within the commands of course.

@Rugvip Rugvip force-pushed the rugvip/multi-word-commands branch 5 times, most recently from b7be6fc to 9f96714 Compare March 7, 2026 10:03
Relax the script name validation to accept spaces, so that
names like 'backstage-cli repo test' work for help generation.
The name is used in help output and usage lines, not for
command routing.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
@Rugvip Rugvip force-pushed the rugvip/multi-word-commands branch from 9f96714 to 802111e Compare March 7, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant