CLI::Command

Here is an example of usage:

  # General Options

  module GeneralOptions
    attr_accessor :dryrun ; alias_accessor :n, :noharm, :dryrun
    attr_accessor :quiet  ; alias_accessor :q, :quiet
    attr_accessor :force
    attr_accessor :trace
  end

  # Build Subcommand

  class BuildCommand < CLI::Command
    include GeneralOptions

    # metadata files
    attr_accessor  :file     ; alias_accessor :f, :file
    attr_accessor  :manifest ; alias_accessor :m, :manifest

    def call
      # do stuf here
    end
  end

  # Box Master Command

  class BoxCommand < CLI::Command
    subcommand :build,     BuildCommand
  end

  BoxCommand.start

Authors

  • Trans

Todo

  • Move helpers into core.
  • Add global options to master command, or "all are master options" flag (?)
  • Add usage/help/documentation/man features (?)

Copying

Copyright (c) 2005,2008 Thomas Sawyer

Ruby License

This module is free software. You may use, modify, and/or redistribute this software under the same terms as Ruby.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Required Files