Class: Hako::CLI::ShowDefinition
- Inherits:
-
Object
- Object
- Hako::CLI::ShowDefinition
- Defined in:
- lib/hako/cli.rb
Instance Method Summary collapse
Instance Method Details
#parse!(argv) ⇒ Object
209 210 211 212 213 214 215 216 217 |
# File 'lib/hako/cli.rb', line 209 def parse!(argv) @expand_variables = false parser.parse!(argv) @path = argv.first if @path.nil? puts parser.help exit 1 end end |
#parser ⇒ Object
219 220 221 222 223 224 225 |
# File 'lib/hako/cli.rb', line 219 def parser @parser ||= OptionParser.new do |opts| opts. = 'hako show-definition FILE' opts.version = VERSION opts.on('--expand', 'Expand variables (Jsonnet only)') { @expand_variables = true } end end |
#run(argv) ⇒ Object
202 203 204 205 206 207 |
# File 'lib/hako/cli.rb', line 202 def run(argv) parse!(argv) require 'hako/application' app = Application.new(@path, expand_variables: @expand_variables) puts JSON.pretty_generate(app.definition) end |