Class: Datadog::Statsd::Schema::Commands::Analyze
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Datadog::Statsd::Schema::Commands::Analyze
- Defined in:
- lib/datadog/statsd/schema/commands/analyze.rb
Overview
Class Attribute Summary collapse
Instance Method Summary collapse
Class Attribute Details
.stderr ⇒ Object
12 13 14 |
# File 'lib/datadog/statsd/schema/commands/analyze.rb', line 12 def stderr @stderr end |
.stdout ⇒ Object
12 13 14 |
# File 'lib/datadog/statsd/schema/commands/analyze.rb', line 12 def stdout @stdout end |
Instance Method Details
#call(**options) ⇒ void
This method returns an undefined value.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/datadog/statsd/schema/commands/analyze.rb', line 29 def call(**) file = [:file] unless file warn "Error: --file option is required" warn "Usage: dss analyze --file <schema.rb>" exit 1 end warn "Analyzing Schema File:" warn " • file #{file.green}" warn " • color: #{([:color] ? "enabled" : "disabled").yellow}" warn " • formar #{[:format].to_s.red}" @schema = ::Datadog::Statsd::Schema.load_file(file) ::Datadog::Statsd::Schema::Analyzer.new([@schema], format: ([:format] || :text).to_sym, stdout: self.class.stdout, stderr: self.class.stderr, color: [:color]).tap do |analyzer| puts analyzer.render end.analyze end |
#puts ⇒ Object
56 57 58 |
# File 'lib/datadog/statsd/schema/commands/analyze.rb', line 56 def puts(...) self.class.stdout.puts(...) end |
#warn ⇒ Object
52 53 54 |
# File 'lib/datadog/statsd/schema/commands/analyze.rb', line 52 def warn(...) self.class.stderr.puts(...) end |