Class: CLI
- Inherits:
-
Thor
- Object
- Thor
- CLI
- Defined in:
- lib/asker/cli.rb
Overview
Command Line User Interface
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
Thor stop and show messages on screen on failure.
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.
- #respond_to_missing?(_method_name) ⇒ Boolean
-
#show_homepage ⇒ Object
Show documentation homepage.
-
#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
87 88 89 |
# File 'lib/asker/cli.rb', line 87 def method_missing(method, *_args, &_block) file(method.to_s) end |
Class Method Details
.exit_on_failure? ⇒ Boolean
Thor stop and show messages on screen on failure
97 98 99 |
# File 'lib/asker/cli.rb', line 97 def self.exit_on_failure? true 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
79 80 81 |
# File 'lib/asker/cli.rb', line 79 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
70 71 72 |
# File 'lib/asker/cli.rb', line 70 def init Asker.create_configuration end |
#respond_to_missing?(_method_name) ⇒ Boolean
91 92 93 |
# File 'lib/asker/cli.rb', line 91 def respond_to_missing?(_method_name) true end |
#show_homepage ⇒ Object
Show documentation homepage
62 63 64 |
# File 'lib/asker/cli.rb', line 62 def show_homepage() puts Application::HOMEPAGE end |
#version ⇒ Object
Show current version
17 18 19 |
# File 'lib/asker/cli.rb', line 17 def version puts "#{Application::NAME} version #{Application::VERSION}" end |