Skip to content
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

Create new string-enum[] type #677

Merged
merged 23 commits into from
Sep 24, 2024
Merged

Conversation

yuandrew
Copy link
Contributor

What was changed

Created a new string-enum[] type

Why?

Command option behavior already exists, there just wasn't a specific type for this yet.

Checklist

  1. Closes [Feature Request] Create new 'string-enum[]' type for the CLI command generation #670

  2. How was this tested:

  1. Any docs updates needed?

temporalcli/strings.go Outdated Show resolved Hide resolved
@yuandrew yuandrew marked this pull request as ready for review September 23, 2024 21:18
temporalcli/strings.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@josh-berry josh-berry left a comment

Choose a reason for hiding this comment

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

LGTM other than please double-check with Chad on the log-format flag.

temporalcli/commandsgen/commands.yml Show resolved Hide resolved
temporalcli/commandsgen/commands.yml Outdated Show resolved Hide resolved
Comment on lines +58 to +61
values := make([]string, 0, len(s.Allowed))
for _, v := range s.Allowed {
values = append(values, v)
}
Copy link
Member

Choose a reason for hiding this comment

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

just a suggestion if you like

Suggested change
values := make([]string, 0, len(s.Allowed))
for _, v := range s.Allowed {
values = append(values, v)
}
values := maps.Values(s.Allowed)

(from "golang.org/x/exp/maps")

Copy link
Member

@cretz cretz Sep 24, 2024

Choose a reason for hiding this comment

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

from "golang.org/x/exp/maps"

I think it's in the standard library now w/ the iter stuff (so not a slice necessarily)

Copy link
Member

Choose a reason for hiding this comment

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

They didn't include Keys and Values from x/exp/maps in the stdlib package. I'm not sure why, they're pretty useful 🤷

@yuandrew yuandrew merged commit 4c1763c into temporalio:main Sep 24, 2024
7 checks passed
yuandrew added a commit to yuandrew/cli that referenced this pull request Oct 2, 2024
<!--- Note to EXTERNAL Contributors -->
<!-- Thanks for opening a PR!
If it is a significant code change, please **make sure there is an open
issue** for this.
We work best with you when we have accepted the idea first before you
code. -->

<!--- For ALL Contributors 👇 -->

<!-- Describe what has changed in this PR -->
Created a new `string-enum[]` type

<!-- Tell your future self why have you made these changes -->
Command option behavior already exists, there just wasn't a specific
type for this yet.

<!--- add/delete as needed --->

1. Closes temporalio#670

2. How was this tested:
<!--- Please describe how you tested your changes/how we can test them
-->

3. Any docs updates needed?
<!--- update README if applicable
      or point out where to update docs.temporal.io -->

---------

Co-authored-by: David Reiss <dnr@dnr.im>
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.

[Feature Request] Create new 'string-enum[]' type for the CLI command generation
4 participants