Class: Sawarineko::CLI
- Inherits:
-
Object
- Object
- Sawarineko::CLI
- Defined in:
- lib/sawarineko/cli.rb
Overview
Handle command line interfaces logic.
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
Initialize a CLi.
-
#run(args = ARGV) ⇒ Object
Entry point for the application logic.
Constructor Details
#initialize ⇒ CLI
Initialize a CLi.
7 8 9 |
# File 'lib/sawarineko/cli.rb', line 7 def initialize = {} end |
Instance Method Details
#run(args = ARGV) ⇒ Object
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.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sawarineko/cli.rb', line 17 def run(args = ARGV) , paths = Option.new.parse(args) source = if paths.empty? $stdin.read else IO.read(paths[0]) end converter = Converter.new puts converter.convert(source) 0 end |