Skip to content

cli: add shorthand aliases to server and agent commands#6897

Draft
Pittu-Sharma wants to merge 4 commits into
spiffe:mainfrom
Pittu-Sharma:feat/cli-shorthands
Draft

cli: add shorthand aliases to server and agent commands#6897
Pittu-Sharma wants to merge 4 commits into
spiffe:mainfrom
Pittu-Sharma:feat/cli-shorthands

Conversation

@Pittu-Sharma

Copy link
Copy Markdown

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality
CLI flag parsing and help documentation for both SPIRE Server and SPIRE Agent.

Description of change
This PR introduces short-form flag aliases (shorthands) across the primary SPIRE command suites to improve usability and align with standard POSIX CLI conventions.

Key improvements:

  • Flag Infrastructure: Added reusable shorthand helper functions in pkg/common/cli/flags.go that wrap the standard Go flag package to support aliases without introducing external dependencies.
  • Applied Aliases: Integrated consistent shorthands for frequently used flags, including:
    • -c for -config
    • -d for -dataDir
    • -v for -logLevel / -verbose
    • -s for -socketPath / -shallow
    • -i for -id / -spiffeID
    • -p for -parentID / -path / -namedPipeName
  • Documentation: Updated the corresponding reference tables in doc/spire_server.md and doc/spire_agent.md.
  • Validation: Updated existing CLI test suites to verify both long and short-form flag variants and confirmed that all help-output assertions pass.

Which issue this PR fixes
fixes #6790

Signed-off-by: pittu sharma <pittusharma47@gmail.com>
Signed-off-by: pittu sharma <pittusharma47@gmail.com>
This commit introduces short-form flag aliases across SPIRE server and agent
command suites to improve CLI usability and align with standard conventions.
Key updates:
- Added reusable flag helpers in pkg/common/cli/flags.go
- Integrated aliases into entry, bundle, healthcheck, and run commands
- Updated documentation and test fixtures to reflect changes

Signed-off-by: pittu sharma <pittusharma47@gmail.com>
@sorindumitru

Copy link
Copy Markdown
Member

Thanks @Pittu-Sharma for opening this PR. We do want to have support for short flags, but we'd want to first switch to a flag library that has native support for this. This avoids the need to have both flags appear as separate options in the help output.

If we do make this change, they would have to happen in a backwards compatible way so that no existing users encounter breaking changes.

@sorindumitru

sorindumitru commented Apr 26, 2026

Copy link
Copy Markdown
Member

@Pittu-Sharma, another option we could explore here is to modify the Usage variable to de-duplicate the output in the help line, so it could say something like:

-socketPath, -s string
    Path to bind the SPIRE Server API socket to

I don't know if it's going to work very well with our subcommands, but if it does and the help out still looks reasonable that may be a good way forward.

@amartinezfayo amartinezfayo marked this pull request as draft June 23, 2026 18:46
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.

short vs long args

2 participants