Skip to content

feat: add version command#471

Merged
rkpattnaik780 merged 2 commits intomainfrom
version_cmd
Mar 19, 2021
Merged

feat: add version command#471
rkpattnaik780 merged 2 commits intomainfrom
version_cmd

Conversation

@rkpattnaik780
Copy link
Contributor

Description

Add a version command so that user won't have to guess between --version or version.

Screenshot from 2021-03-19 13-04-11

fixes #469

Verification Steps

  1. Run rhoas version

./rhoas version

  1. You should see rhoas version <version> as the output

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • Documentation added for the feature
  • CI and all relevant tests are passing
  • Code Review completed
  • Verified independently by reviewer

Copy link
Contributor

@craicoverflow craicoverflow left a comment

Choose a reason for hiding this comment

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

This is great, very neat PR.

Something that could be done in a follow up PR, or here if you prefer, would be to use the same version output defined in this command and to use it as the text for the --version flag. This way, if we ever want to change the text that is displayed, we only need to update the locales file and both will be changed!

See https://github.com/spf13/cobra#version-flag


cmd := &cobra.Command{
Use: localizer.MustLocalizeFromID("version.cmd.use"),
Hidden: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I never would have thought of adding this but it make so much sense! I did not see it in Cobra docs, how did you find out about it? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed gh cli doesnt show version command, so I went on to check its implementation :) .

Copy link
Contributor

@craicoverflow craicoverflow Mar 19, 2021

Choose a reason for hiding this comment

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

Nice research work! Cobra's docs are a bit poor aren't they? There seems to be no API reference documentation which covers many configuration options.

@rkpattnaik780 rkpattnaik780 merged commit 461ffb3 into main Mar 19, 2021
@rkpattnaik780 rkpattnaik780 deleted the version_cmd branch March 19, 2021 12:27
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.

Add a rhoas version subcommand

2 participants