Class: CLI
- Inherits:
-
Thor
- Object
- Thor
- CLI
- Defined in:
- lib/asker/cli.rb
Overview
Command Line User Interface
Instance Method Summary collapse
-
#check(filename) ⇒ Object
Check input file syntax.
-
#create_input(dirname) ⇒ Object
Create Asker demo input files.
-
#file(filename) ⇒ Object
Create questions from input file.
-
#init ⇒ Object
Create default INI config file.
-
#method_missing(method, *_args, &_block) ⇒ Object
This actions are equals: * asker demo/foo.haml * asker file demo/fool.haml.
-
#version ⇒ Object
Show current version.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *_args, &_block) ⇒ Object
This actions are equals:
-
asker demo/foo.haml
-
asker file demo/fool.haml
79 80 81 |
# File 'lib/asker/cli.rb', line 79 def method_missing(method, *_args, &_block) file(method.to_s) end |
Instance Method Details
#check(filename) ⇒ Object
Check input file syntax
51 52 53 54 55 56 |
# File 'lib/asker/cli.rb', line 51 def check(filename) # Enable/disable color output Rainbow.enabled = false if ['color'] == false # Asker start processing input file Asker.check(filename) end |
#create_input(dirname) ⇒ Object
Create Asker demo input files
71 72 73 |
# File 'lib/asker/cli.rb', line 71 def create_input(dirname) Asker.create_input(dirname) end |
#file(filename) ⇒ Object
Create questions from input file
41 42 43 44 |
# File 'lib/asker/cli.rb', line 41 def file(filename) # Asker start processing input file Asker.start(filename) end |
#init ⇒ Object
Create default INI config file
62 63 64 |
# File 'lib/asker/cli.rb', line 62 def init Asker.create_configuration end |
#version ⇒ Object
Show current version
17 18 19 20 |
# File 'lib/asker/cli.rb', line 17 def version print Rainbow(Application::NAME).bright.blue puts " (version #{Rainbow(Application::VERSION).green})" end |