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
215 216 217 218 219 220 221 222 223 |
# File 'lib/hako/cli.rb', line 215 def parse!(argv) @expand_variables = false parser.parse!(argv) @path = argv.first if @path.nil? puts parser.help exit 1 end end |
#parser ⇒ Object
225 226 227 228 229 230 231 |
# File 'lib/hako/cli.rb', line 225 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
208 209 210 211 212 213 |
# File 'lib/hako/cli.rb', line 208 def run(argv) parse!(argv) require 'hako/application' app = Application.new(@path, expand_variables: @expand_variables) puts JSON.pretty_generate(app.definition) end |