Class: Cliqr::Interface Private
- Inherits:
-
Object
- Object
- Cliqr::Interface
- Defined in:
- lib/cliqr/interface.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The execution interface to a command line application built using Cliqr
Instance Attribute Summary collapse
-
#config ⇒ Cliqr::CLI::Config
private
Command line interface configuration.
Class Method Summary collapse
-
.build(config) ⇒ Cliqr::CLI::Interface
private
Invoke the builder method for [Cliqr::CLI::Interface].
Instance Method Summary collapse
-
#execute(args = [], **options) ⇒ Integer
private
Execute a command.
-
#execute_internal(args = [], **options) ⇒ Integer
private
Executes a command without handling error conditions.
-
#initialize(config) ⇒ Interface
constructor
private
Create a new interface instance with a config.
-
#usage ⇒ String
private
Get usage information of this command line interface instance.
Constructor Details
#initialize(config) ⇒ Interface
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new interface instance with a config
21 22 23 24 |
# File 'lib/cliqr/interface.rb', line 21 def initialize(config) @config = config @runner = Executor::Runner.new(config) end |
Instance Attribute Details
#config ⇒ Cliqr::CLI::Config
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Command line interface configuration
16 17 18 |
# File 'lib/cliqr/interface.rb', line 16 def config @config end |
Class Method Details
.build(config) ⇒ Cliqr::CLI::Interface
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Invoke the builder method for [Cliqr::CLI::Interface]
63 64 65 |
# File 'lib/cliqr/interface.rb', line 63 def self.build(config) InterfaceBuilder.new(config).build end |
Instance Method Details
#execute(args = [], **options) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute a command
39 40 41 42 43 44 45 |
# File 'lib/cliqr/interface.rb', line 39 def execute(args = [], **) execute_internal(args, ) Executor::ExitCode.code(:success) rescue Cliqr::Error::CliqrError => e puts e. Executor::ExitCode.code(e) end |
#execute_internal(args = [], **options) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Executes a command without handling error conditions
50 51 52 53 54 55 56 |
# File 'lib/cliqr/interface.rb', line 50 def execute_internal(args = [], **) = { :output => :default, :environment => :cli }.merge() @runner.execute(args, ) end |
#usage ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get usage information of this command line interface instance
29 30 31 |
# File 'lib/cliqr/interface.rb', line 29 def usage Usage::UsageBuilder.new(:cli).build(config) end |