lib/vindetta/cli.rb in vindetta-0.7.0 vs lib/vindetta/cli.rb in vindetta-0.8.0

- old
+ new

@@ -1,29 +1,37 @@ -require 'gli' +require "gli" module Vindetta class CLI extend GLI::App - program_desc 'Vehicle Identification Number (VIN) CLI' + program_desc "Vehicle Identification Number (VIN) CLI" - desc 'Transliterates a VIN character' - arg_name 'character' - command [:transliterate, :t] do |c| + desc "Transliterates a VIN character" + arg_name "character" + command %i[transliterate t] do |c| c.action do |_global, _options, args| puts Vindetta::Transliterator.run(args.first) end end - desc 'Validates a VIN' - command [:validate, :v] do |c| + desc "Validates a VIN" + command %i[validate v] do |c| c.action do |_global, _options, args| puts Vindetta::Validator.run(args.first) end end - desc 'Generates a random VIN' - command [:generate, :g] do |c| + desc "Decodes a VIN" + command %i[decode d] do |c| + c.action do |_global, _options, _args| + vin = Vindetta::Vin.new(_args.first) + puts Vindetta::Decoder.decode(vin) + end + end + + desc "Generates a random VIN" + command %i[generate g] do |c| c.action do |_global, _options, _args| puts Vindetta::Generator.generate end end end