From 33de5ccce158cb7846796419f4d4d34869689cdf Mon Sep 17 00:00:00 2001 From: JoanLn Date: Mon, 4 Dec 2023 15:27:08 -0500 Subject: [PATCH] feat: Add version command with CLI Add graphql-docs -v and graphql-docs --version to output the gem version so people know which version they're running --- exe/graphql-docs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/exe/graphql-docs b/exe/graphql-docs index 6b0a03c..fee52cc 100755 --- a/exe/graphql-docs +++ b/exe/graphql-docs @@ -28,9 +28,15 @@ OptionParser.new do |parser| parser.on("-o", "--output-dir DIR", "Where the site is generated to, defaults to ./output") parser.on("-d", "--delete-output", "Delete the output-dir before generating, defaults to false") parser.on("-b", "--base-url URL", "URL to preprend for assets and links, defaults to \"\"") + parser.on("-v", "--version", "Show the version") parser.on("--verbose", "Run in verbose mode") end.parse!(into: opts) +if opts[:version] + puts("v#{GraphQLDocs::VERSION}") + exit +end + def err(msg) abort("#{NAME}: Error: #{msg}") end