lib/cli.rb in natophone-0.0.2 vs lib/cli.rb in natophone-0.0.3
- old
+ new
@@ -5,33 +5,35 @@
module NATOPhone
class NATOPhoneCLI < Thor
desc "encode WORD(S)", "Encode to NATO alphabet"
+ map "-E" => "encode"
option :yell, aliases: '-Y', type: :boolean, desc: "Option to YELL the translation"
option :json, aliases: '-J', type: :boolean, desc: "Option to export the translation in JSON"
def encode(*args)
enc = NATOPhone::Encoder.new(args)
if options[:yell]
puts "\n#{enc.yell}\n\n"
elsif options[:json]
puts enc.to_json
else
- puts "\n#{enc.translate}\n\n"
+ puts "\n#{enc}\n\n"
end
end
desc "decode NATO", "Decode from NATO alphabet"
+ map "-D" => "decode"
option :yell, aliases: '-Y', type: :boolean, desc: "Option to YELL the translation"
option :json, aliases: '-J', type: :boolean, desc: "Option to export the translation in JSON"
def decode(*args)
dec = NATOPhone::Decoder.new(args)
if options[:yell]
puts "\n#{dec.yell}\n\n"
elsif options[:json]
puts dec.to_json
else
- puts "\n#{dec.translate}\n\n"
+ puts "\n#{dec}\n\n"
end
end
end
end