diff --git a/bin/httparty b/bin/httparty index 6b140af..1cc13f4 100755 --- a/bin/httparty +++ b/bin/httparty @@ -62,6 +62,12 @@ OptionParser.new do |o| puts o exit end + + o.on("--version", "Show the version") do |ver| + puts "The current version is: #{HTTParty::VERSION}" + exit + end + end.parse! if ARGV.empty? diff --git a/features/command_line.feature b/features/command_line.feature index df2c197..8a2d11e 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -9,6 +9,11 @@ Feature: Command Line When I run `httparty --help` Then the output should contain "-f, --format [FORMAT]" + Scenario: Show httparty version at command line + When I run `httparty --version` + Then the output should contain "The current version is:" + And the output should not contain "You need to provide a URL" + Scenario: Make a get request Given a remote deflate service on port '4001' And the response from the service has a body of 'GET request' @@ -87,4 +92,4 @@ Feature: Command Line And that service is accessed at the path '/service.csv' And the response from the service has a Content-Type of 'application/csv' When I run `httparty http://0.0.0.0:4010/service.csv --format csv` - Then the output should contain '["Last Name", "Name"]' \ No newline at end of file + Then the output should contain '["Last Name", "Name"]'