brettchalupa/graphql-docs

Ouput gem ver with CLI

Closed this issue ยท 6 comments

graphql-docs -v or graphql-docs --version to output the gem version so people know which version they're running

JoanLn commented

Hi @brettchalupa, May I work on this? If yes, please assign this issue to me, thanks!

@JoanLn go for it, thank you! ๐Ÿ™Œ

JoanLn commented

@brettchalupa Just want to clarify, do you want to show the version of graphql-docs as well, or just for gem?
Here's the result I have so far.
image

As the contributing guide says, I have to ensure tests pass by running bin/rake, but I kept getting error("Command failed with status (127)"). Here' the error message.
image
I could run the ruby command direclty, though the result was failed.
image

May I ask some help for this?
Thanks!

@JoanLn happy to help! Nice progress so far. ๐Ÿ™Œ

Here's some more info on what I'd expect from this addition:

User runs this command:

$ graphql-docs -v
v4.0.0

and it outputs the version from GraphQLDocs::VERSION constant, defined in this file: https://github.com/brettchalupa/graphql-docs/blob/main/lib/graphql-docs/version.rb#L4

A stretch goal would be to support --version too, a longer version of the CLI flag.

That VERSION constant gets updated whenever there's a new release, so it's a reliable way to know what version is installed.

That's strange about bin/rake but I'd say don't worry about it. If you can get a PR open, the tests will run automatically on GitHub. They may fail due to #143 but I'll try to fix that soon.

Let me know if I can be of any additional help.

JoanLn commented

Hi @brettchalupa

Here's what I made so far:
image

The user can use graphql-docs -v/--version to query the version infromation.
I modify the version.rb file to see if the it will get updated when new version is installed, and it seems work.

Please let me know if anything need to be changed, or I can open a PR.

@JoanLn looks great, thank you for taking this on. Looks like it's ready for a PR. ๐Ÿ‘ ๐Ÿ™Œ