Class: Yanagi::CLI
- Inherits:
-
Object
- Object
- Yanagi::CLI
- Defined in:
- lib/yanagi/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ CLI
Returns a new instance of CLI.
17 18 19 |
# File 'lib/yanagi/cli.rb', line 17 def initialize(args) @args = args.dup end |
Class Method Details
.start(args = ARGV) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/yanagi/cli.rb', line 10 def self.start(args = ARGV) # Output is Ukrainian/Japanese text; emit UTF-8 regardless of the caller's locale. $stdout.set_encoding(Encoding::UTF_8) $stderr.set_encoding(Encoding::UTF_8) new(args).run end |
Instance Method Details
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/yanagi/cli.rb', line 21 def run cmd = @args.shift case cmd when "romaji" cmd_romaji when "cyrillic" cmd_cyrillic when "audit" cmd_audit when "apply" cmd_apply when "doc-sync", "doc_sync" cmd_doc_sync when "lexicon" cmd_lexicon when "verify-gold", "verify_gold" cmd_verify_gold when "-v", "--version", "version" puts "yanagi #{Yanagi::VERSION}" when "-h", "--help", "help", nil print_help else warn "Unknown command: #{cmd}" print_help exit 1 end end |