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

Make argument and flag use consistent across commands #511

Merged
merged 5 commits into from
Mar 29, 2024

Conversation

josh-berry
Copy link
Collaborator

Closes #343. See the issue for the full discussion and rationale behind the specific changes made.

@josh-berry josh-berry requested review from cretz and a team March 27, 2024 23:34
@CLAassistant
Copy link

CLAassistant commented Mar 27, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Closes #343. See the issue for the full discussion and rationale behind
the specific changes made.
@@ -49,7 +49,7 @@ This document has a specific structure used by a parser. Here are the rules:

#### Options

* `--env` (string) - Environment to read environment-specific flags from. Default: default. Env: TEMPORAL_ENV.
* `--env`, `-E` (string) - Environment to read environment-specific flags from. Default: default. Env: TEMPORAL_ENV.
Copy link
Member

Choose a reason for hiding this comment

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

Not sure we should add a new global alias for this. I think the previous way of changing environment from default was good enough.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The alternative is to be inconsistent and have a different --env flag for temporal env. I think this is worse than simply adding a global alias.

I also like the global alias because it uses less visual and cognitive space for what is essentially contextual information. So overall I feel pretty strongly about keeping it.

Copy link
Member

@cretz cretz Mar 28, 2024

Choose a reason for hiding this comment

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

I don't think it'll get used very much and I think the bar for our second-ever global alias should be a bit higher. Do you want to apply this strong feeling generally or just now to this one? I like our existing stance of rare aliases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This specific one. I think the other options are much less likely to be used, whereas I could see -E being used quite commonly/consistently, especially in ops scenarios where an operator is dealing with multiple environments. (I also agree with having -o for the output format.)

Copy link
Member

Choose a reason for hiding this comment

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

This flag has been here for years and years sans alias, I don't think it's that common, it has value forcing a user to be clear they are changing environments, and I wouldn't expect an alias to change profile/env/context any more than I'd expect aws CLI to have an alias for --profile or kubectl/docker to have an alias for --context.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This flag has been here for years and years sans alias, I don't think it's that common

You are ignoring the fact that we are now using it in a different way.

I think it's pretty ugly/amateurish to be forced to mix and match especially for required options:

temporal env set --env prod -k address -v example.com:3233

And I would find

temporal env set --env prod --key address --value example.com:3233

annoyingly verbose.

The only other alternative I could think of is to have a special version of --env on temporal env commands that has a short form, but again, this is inconsistent and therefore surprising.

If you have another suggestion I haven't thought of, I'm all ears.

Copy link
Member

Choose a reason for hiding this comment

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

You are ignoring the fact that we are now using it in a different way.

Not if we're discussing the global alias which is my primary concern. While I don't like it for temporal env subcommands either, I think we can agree we are not using it in a different way for the vast majority of commands.

And I would find [...] annoyingly verbose

This is subjective and not shared by the other example binaries I linked there, so at the least they didn't agree. This new global alias applies to your words from earlier:

It can also sometimes be a deliberate design decision to not have a short-form alias (e.g. for something obscure or dangerous)

Emphasis mine. It is dangerous to change env/profile/context. Regardless, I think aws or kubectl or docker or those similar tools with contextual pieces like this can provide guidance here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Regardless, I think aws or kubectl or docker or those similar tools with contextual pieces like this can provide guidance here.

You are correct about aws, however:

  • kubectl has -s for which API server to connect to, though I agree --context has no short-form
  • docker has -c for which context to use and -H for which host to use

So the record is rather mixed here.

Regardless, we've exhausted my time budget on this, so I will concede because it's easier to add it in later than it is to remove it if we later decide we don't want it.

Copy link
Member

Choose a reason for hiding this comment

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

👍 I will also concede the -k and -v since the blast radius of your change there is limited if you want to add those back. My bigger concern was this new global alias we were adding.

temporalcli/commands.env.go Outdated Show resolved Hide resolved
temporalcli/commandsmd/commands.md Show resolved Hide resolved
temporalcli/commands.operator_namespace.go Outdated Show resolved Hide resolved
temporalcli/commands.operator_namespace.go Outdated Show resolved Hide resolved
temporalcli/commands.operator_namespace.go Outdated Show resolved Hide resolved
@josh-berry josh-berry merged commit 03cdfde into cli-rewrite Mar 29, 2024
6 checks passed
@josh-berry josh-berry deleted the josh/update-args-flags-343 branch March 29, 2024 22:15
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.

3 participants