Sha256: 10c9303d65f5a1f7f454c57f13f5b812bf324344f4d25be0f1dec74109f47806
Contents?: true
Size: 1.3 KB
Versions: 14
Compression:
Stored size: 1.3 KB
Contents
#!/usr/bin/env ruby $LOAD_PATH.unshift(File.expand_path('../../../lib',__FILE__)) require 'command_kit/commands' require_relative 'cli/config' require_relative 'cli/list' require_relative 'cli/update' module Foo # # The main CLI command. # class CLI include CommandKit::Commands class << self # The global configuration file setting. # # @return [String, nil] attr_accessor :config_file end command_name 'foo' # Commands must be explicitly registered, unless # CommandKit::Commands::AutoLoad.new(...) is included. command Config command List command Update # Commands may have aliases command_aliases['ls'] = 'list' command_aliases['up'] = 'update' # Global options may be defined which are parsed before the sub-command's # options are parsed and the sub-command is executed. option :config_file, short: '-C', value: { type: String, usage: 'FILE' }, desc: 'Global option to set the config file' do |file| CLI.config_file = file end end end if $0 == __FILE__ # Normally you would invoke Foo::CLI.start from a bin/ script. Foo::CLI.start end
Version data entries
14 entries across 14 versions & 2 rubygems