Possible to "hide" a command?

This may seem strange, but is there any way to hide a command so it doesn't show up in the help?

1 Like

You can specify help: .hidden when initializing the argument property wrapper.

https://github.com/apple/swift-argument-parser/blob/master/Documentation/04%20Customizing%20Help.md#hiding-arguments-and-commands

For a command/subcommand (rather than a flag), you can set shouldDisplay: false in the CommandConfiguration to hide it.

We use this in swift-format when we migrated to swift-argument-parser and wanted to retire the old --mode <format | lint | dump-configuration> flag in favor of subcommands. Here's an example where we're temporarily providing a hidden "legacy main" subcommand that has the deprecated option.

2 Likes