Class: Wavefront::Cli
- Inherits:
-
Object
- Object
- Wavefront::Cli
- Defined in:
- lib/wavefront/cli.rb
Overview
Parent of all the CLI classes.
Direct Known Subclasses
Alerts, BatchWrite, Dashboards, Events, Sources, Ts, Write
Defined Under Namespace
Classes: Alerts, BatchWrite, Dashboards, Events, Sources, Ts, Write
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#noop ⇒ Object
Returns the value of attribute noop.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options, arguments) ⇒ Cli
constructor
A new instance of Cli.
- #validate_opts ⇒ Object
Constructor Details
#initialize(options, arguments) ⇒ Cli
Returns a new instance of Cli.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/wavefront/cli.rb', line 26 def initialize(, arguments) @options = @arguments = arguments @noop = [:noop] if .include?(:help) && [:help] puts exit 0 end end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
24 25 26 |
# File 'lib/wavefront/cli.rb', line 24 def arguments @arguments end |
#noop ⇒ Object
Returns the value of attribute noop.
24 25 26 |
# File 'lib/wavefront/cli.rb', line 24 def noop @noop end |
#options ⇒ Object
Returns the value of attribute options.
24 25 26 |
# File 'lib/wavefront/cli.rb', line 24 def @options end |
Instance Method Details
#validate_opts ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/wavefront/cli.rb', line 37 def validate_opts # # There are things we need to have. If we don't have them, # stop the user right now. Also, if we're in debug mode, print # out a hash of options, which can be very useful when doing # actual debugging. Some classes may have to override this # method. The writer, for instance, uses a proxy and has no # token. # raise 'Please supply an API token.' unless [:token] raise 'Please supply an API endpoint.' unless [:endpoint] end |