Class: Wavefront::Cli
- Inherits:
-
Object
- Object
- Wavefront::Cli
- Defined in:
- lib/wavefront/cli.rb
Defined Under Namespace
Classes: Alerts, BatchWrite, Events, Sources, Ts, Write
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options, arguments) ⇒ Cli
constructor
A new instance of Cli.
- #load_profile ⇒ Object
Constructor Details
#initialize(options, arguments) ⇒ Cli
Returns a new instance of Cli.
24 25 26 27 28 29 30 31 32 |
# File 'lib/wavefront/cli.rb', line 24 def initialize(, arguments) @options = @arguments = arguments if .include?(:help) && [:help] puts exit 0 end end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
22 23 24 |
# File 'lib/wavefront/cli.rb', line 22 def arguments @arguments end |
#options ⇒ Object
Returns the value of attribute options.
22 23 24 |
# File 'lib/wavefront/cli.rb', line 22 def @options end |
Instance Method Details
#load_profile ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/wavefront/cli.rb', line 34 def load_profile # # Load in configuration options from the (optionally) given # section of an ini-style configuration file. If the file's # not there, we don't consider that an error. # return unless [:config].is_a?(String) cf = Pathname.new([:config]) return unless cf.exist? pf = [:profile] || 'default' puts "using #{pf} profile from #{cf}" if [:debug] IniFile.load(cf)[pf].each_with_object({}) do |(k, v), memo| memo[k.to_sym] = v end end |