Skip to content

Fix:(issue_2056) Add cmd.XXXArgs() functions for retrieving args #2088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

dearchap
Copy link
Contributor

@dearchap dearchap commented Apr 2, 2025

What type of PR is this?

(REQUIRED)

  • feature

What this PR does / why we need it:

(REQUIRED)

Add functions to allow Args access. Two classes of functions are available on the command
one for single value arguments and one for multi value/slice

Which issue(s) this PR fixes:

(REQUIRED)

Fixes #2056

Special notes for your reviewer:

(fill-in or delete this section)

Testing

(fill-in or delete this section)

go test -run=Test*Args

Release Notes

(REQUIRED)

New classes of accessor functions for different argument types has been added. One for single value arguments and one for multiple values/slices

- StringArg
- StringArgs
- FloatArg
- FloatArgs
- IntArg
- IntArgs
- UintArg
- UintArgs
- TimestampArg
- TimestampArgs

Only the single value arguments can have a default value. Parsing of arguments will stop at the first argument that fails either parsing or constraint mismatch

@dearchap dearchap requested a review from a team as a code owner April 2, 2025 01:01
Copy link
Member

@meatballhat meatballhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fully admit that I mostly skimmed this! I'd love to know the answer to @Juneezee's question, too, but I don't have any blocking feedback.

Other notes:

  • I'm reminded that I'd like to make sure argument and flag types from external packages are possible.
  • The use of private members in the public ArgumentBase declarations still looks funny to me 🤔 e.g. the timestampValue in ArgumentsBase[time.Time, TimestampConfig, timestampValue]

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.

Clarification regarding Command.Arguments property
3 participants