Sha256: 531d1a5142d43856617815c4852aa41566265944c53ec13357c4e215247b60f4

Contents?: true

Size: 914 Bytes

Versions: 1

Compression:

Stored size: 914 Bytes

Contents

#
# Delegate execution to a sub command
#
# SYNOPSIS
#   #{program_name} [--version] [--help] [--output=...] COMMAND [cmd opts] ARGS...
#
# OPTIONS
# #{summarized_options}
#
# COMMANDS
# #{summarized_subcommands}
#
# DESCRIPTION
#   This example shows how to write a delegator command, that is, a
#   command which delegates to a subcommand
#
# See '#{program_name} help COMMAND' for more information on a specific command.
#
class Delegator < Quickl::Delegator(__FILE__, __LINE__)

  # Single command version
  VERSION = "0.1.0"
  
  # Install options
  options do |opt|
    
    # Show the help and exit
    opt.on_tail("--help", "Show help") do
      raise Quickl::Help
    end

    # Show version and exit
    opt.on_tail("--version", "Show version") do
      raise Quickl::Exit, "#{program_name} #{VERSION} (c) 2010, Bernard Lambeau"
    end

  end

end # class Delegator
require "help"
require "hello_world"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quickl-0.2.0 examples/delegator/lib/delegator.rb