File Stats
- Last Modified
- Wed Sep 29 22:35:44 -0400 2010
Information
Method Index
- Executioner ::attr_switch
- Executioner ::descriptions
- Executioner ::execute
- Executioner ::find_longer_option
- Executioner ::footer
- Executioner ::header
- Executioner ::help
- Executioner ::inspect
- Executioner ::invoke
- Executioner ::method_added
- Executioner::NoCommandError ::new
- Executioner::Help ::new
- Executioner::NoOptionError ::new
- Executioner ::parse
- Executioner ::parse_arguments
- Executioner ::parse_equal
- Executioner ::parse_flags
- Executioner ::parse_option
- Executioner ::parse_subcommand
- Executioner ::run
- Executioner ::subcommands
- Executioner ::to_s
- Executioner::Help #help_text
- Executioner #main
- Executioner #option_missing
- Executioner::Help #to_manpage
Executioner
DESCRIPTION
Executioner is a very striaght-forward CLI framework for Ruby. A single class can define a complete multi-command command line tool using nothing more than Ruby’s own method definitions.
SYNOPSIS
Using Executioner is straight-forward. Simply subclass the `Executioner` base class and add methods to handle subcommands and command-line options. A plan method corresponds to a subcommand, an writer method (ending in ’=’) to an option and a query method (ending in ’?’) to a flag. For example, here is a simple commandline tool to run a Ruby script.
require 'executioner'
class RunCLI < Executioner
help "Require LIBRARY before executing your script"
def require=(lib)
require lib
end
alias :r= :require=
help "Include PATH in $LOAD_PATH"
def include=(path)
$:.unshift path
end
alias :I= :incude
help "Run in DEBUG mode"
def debug?
$DEBUG = true
end
help "Show this message"
def help?
puts self
exit
end
alias :h? :help?
def main(script)
load(script)
end
end
For a more detail example see EXAMPLE.rdoc.
COPYRIGHT
Copyright © 2009 Thomas Sawyer
Executor is distributed under the terms of the Apache License v2.0.
Please see LICENSE file for details.