Sha256: 541fba103cee859895780779bf343b1ff9c11359288875c152b8ed18d5b81a4b

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

require 'brigadier'

# You can run like so:
#
# ruby intermediate.rb
# ruby intermediate.rb --help
# ruby intermediate.rb guest
# ruby intermediate.rb guest --help
# ruby intermediate.rb guest --debug 'John Smith'

module Commands
  class Intermediate
    extend Brigadier

    toggle 'debug', 'Debugging toggle'
    toggle 'verbose', 'Verbose mode', default: true

    sub_command 'guest', 'Guest sub command' do
      argument 'name', 'Name of guest', required: true

      execute do
        puts "Inside guest sub command's \#execute: name: #{name}, debug?: #{debug?}, verbose?: #{verbose?}"
      end
    end
  end
end

Brigadier::Runner.new(ARGV).run(Commands::Intermediate)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brigadier-0.1.2 examples/intermediate.rb
brigadier-0.1.1 examples/intermediate.rb