Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore:version sub command remove--version and-v flag#2090

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 6 commits intomainfromstevenmasley/version_cmd
Jun 6, 2022

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedJun 6, 2022
edited
Loading

What this does (#1543)

Removescoder -v andcoder --version.

Now docoder version to see coder version.

$ coder versionCoder v0.0.0-devel+ae779c6 Mon Jun  6 15:18:00 UTC 2022https://github.com/coder/coder/commit/ae779c6276a5f305273343c3d5d4836d6a16c890

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

Thanks for picking this one up! 👍🏻

cli/root.go Outdated
func versionCmd() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Version for coder",
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: I think this reads a bit better, but up to you to include or not.

Suggested change
Short:"Version forcoder",
Short:"Showcoder version",

Emyrk reacted with thumbs up emoji
cli/root.go Outdated
Comment on lines 115 to 116
cmd.Flags().BoolP("placeholder", "v", false, "This flag is a placeholder to make the cobra version flag work appropriately")
_ = cmd.Flags().MarkHidden("placeholder")
Copy link
Member

Choose a reason for hiding this comment

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

Cobra doesn't add this flag ifVersion isn't specified in the root. I'd propose that being a cleaner alternative.

Having--version andcoder version seems unnecessary to me. I'd prefer to havecoder version.

Copy link
Member

Choose a reason for hiding this comment

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

I’m fine with only havingversion but having both is consistent withhelp (or do I misremember?) and I think covers a common use case. I.e. there’s a 50/50 chance someone will blindly do either--version orversion instead of checking help 😄.

Copy link
Member

Choose a reason for hiding this comment

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

I like how Go just doesgo version. I haven't found it to be confusing tbh

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Correct cobra does not. However if we want to support--version, we would need a persistent pre-run function to support the flag. Cobra has some first class support for--version that works even if there are extra args, eg:coder --version workspaces.

I think it is reasonable to use their first class support for this reason.

As for--version orcoder version. I don't see anything wrong with supporting both. It's nice as a user to do w/e is more familiar to you.

Maybecoder version can report more info like the version of the deployment you are logged into.

Examples:

  • git version &git --version
  • docker --version is less verbose thandocker version
  • docker-compose --version is less verbose thandocker-compose version

Copy link
Member

Choose a reason for hiding this comment

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

It's fine to support both, I don't really understand why we need to though. Seems like supportingcoder version is fine, and supporting both seems to not really satisfy a need, but adds an additional user-contract for us to test.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'll drop the flag for now then and just docoder version

@EmyrkEmyrk changed the titlechore:version sub command and reserve-v flag on root.chore:version sub command remove--version and-v flagJun 6, 2022
@EmyrkEmyrk merged commite2b2580 intomainJun 6, 2022
@EmyrkEmyrk deleted the stevenmasley/version_cmd branchJune 6, 2022 22:38
kylecarbs pushed a commit that referenced this pull requestJun 10, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kylecarbskylecarbskylecarbs approved these changes

@mafredrimafredriAwaiting requested review from mafredri

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Emyrk@mafredri@kylecarbs

[8]ページ先頭

©2009-2025 Movatter.jp