Sha256: 5c11856e7647ecae8cfc2feba0c56b7aef623e0d99b01d892328bcb760eba6d1

Contents?: true

Size: 912 Bytes

Versions: 1

Compression:

Stored size: 912 Bytes

Contents

require "gli"

module Vindetta
  class CLI
    extend GLI::App

    program_desc "Vehicle Identification Number (VIN) CLI"

    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 %i[validate v] do |c|
      c.action do |_global, _options, args|
        puts Vindetta::Validator.run(args.first)
      end
    end

    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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vindetta-0.8.0 lib/vindetta/cli.rb