Sha256: c3d8d92681015a7b83e0b4413839549fbee1451aaa700c9b6ceb85027751a9a7

Contents?: true

Size: 717 Bytes

Versions: 3

Compression:

Stored size: 717 Bytes

Contents

include Boot::Lib::Core

require 'JSON'

module Boot::Lib::Commands
  options_obj = Slop::Options.new
  options_obj.on "--all", "Print all config options. Can not be used with any other arguments."
  
  Config = SubCommand.new(
    'config', # Name of the sub command
    'Read configuration options',
    options_obj
  ) { |options, args|
    parsed_options = options.parse(args);
    if (!parsed_options[:all])
      option_name = args[0]
      option_val = Boot.config.config[option_name]
      if (option_val == nil)
        puts "No option '#{option_name}'"
      else
        puts "#{option_name} = #{option_val}"
      end
    else
      puts JSON.pretty_generate(Boot.config.config)
    end
  }
  @Config
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
boot-cli-1.0.0 lib/Boot/Lib/Commands/Config.rb
boot-cli-0.3.1 lib/Boot/Lib/Commands/Config.rb
boot-cli-0.3.0 lib/Boot/Lib/Commands/Config.rb