class Sawarineko::CLI
Handle command line interfaces logic.
Public Class Methods
new()
click to toggle source
Initialize a CLi.
# File lib/sawarineko/cli.rb, line 7 def initialize @options = {} end
Public Instance Methods
run(args = ARGV)
click to toggle source
Entry point for the application logic. Process command line arguments and run the Sawarineko
.
args - An Array of Strings user passed.
Returns an Integer UNIX exit code.
# File lib/sawarineko/cli.rb, line 17 def run(args = ARGV) @options, paths = Option.new.parse(args) source = if paths.empty? $stdin.read else IO.read(paths[0], encoding: @options[:encoding]) end converter = Converter.new(@options[:encoding]) puts converter.convert(source) 0 end