Class: Zui::CLI
- Inherits:
-
Object
- Object
- Zui::CLI
- Defined in:
- lib/zui/cli.rb
Constant Summary collapse
- USAGE =
"Usage: zui <new NAME|configure|doctor [--fix]|run FILE|bundle [--dist] [--lite|--full] [--no-tree-shake] [DIRECTORY]|version>"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(out:, err:) ⇒ CLI
constructor
A new instance of CLI.
- #run(arguments) ⇒ Object
Constructor Details
#initialize(out:, err:) ⇒ CLI
Returns a new instance of CLI.
14 15 16 17 |
# File 'lib/zui/cli.rb', line 14 def initialize(out:, err:) @out = out @err = err end |
Class Method Details
.run(arguments, out: $stdout, err: $stderr) ⇒ Object
10 11 12 |
# File 'lib/zui/cli.rb', line 10 def self.run(arguments, out: $stdout, err: $stderr) new(out:, err:).run(arguments.dup) end |
Instance Method Details
#run(arguments) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/zui/cli.rb', line 19 def run(arguments) command = arguments.shift case command when "new" then new_project(arguments) when "configure" then configure(arguments) when "run" then run_file(arguments) when "bundle" then bundle_project(arguments) when "doctor" then doctor(arguments) when "version", "--version", "-v" then @out.puts(VERSION); 0 else @err.puts(USAGE) command.nil? ? 0 : 64 end rescue Interrupt 130 rescue ArgumentError, SystemCallError, JSON::ParserError => error @err.puts("zui: #{error.}") 1 end |