Command-line Ruby Utilities Shipped as Classes
MIT License
Quickl helps you create commandline programs as simply as:
#
# Short description here
#
# SYNOPSIS
# Usage: ...
#
# OPTIONS:
# #{summarized_options}
#
# DESCRIPTION
# Long description here...
#
class SimpleCommand < Quickl::Command(__FILE__, __LINE__)
# install options below
options do |opt|
# _opt_ is an OptionParser instance
end
# install the code to run the command
def execute(args)
# _args_ are non-option command line parameters
end
end
Running them as simply as:
SimpleCommand.run(ARGV)
From simple command to complex delegator (ala 'git [--version] [--help] COMMAND [cmd options] ARGS...'), Quickl provides (or aims at providing) the following features:
sudo gem install quickl
Try this:
# have a look at options
quickl --help
# generate a hello.rb single command
quickl --layout=single --options=help,version hello > hello.rb
# test your command
ruby hello.rb --help
ruby hello.rb --version
ruby hello.rb bob
# see what has been generated
cat hello.rb
Additional examples (see examples folder):
A few other gems similarly provide tools to generate commandline app.
Until version 1.0.0, moditications of public interfaces increase the minor version, while other changes increase the tiny version. After version 1.0.0, same changes will affect major and minor versions, respectively.
0.1.0 -> 0.1.1 # enhancements and private API changes
0.1.0 -> 0.2.0 # broken API on public interfaces
Public interfaces are:
Until version 1.0.0, to preserve your application from hurting changes you should require quickl as follows:
gem 'quickl', '~> 0.2.0' # Assuming current version is 0.2.xx
require 'quickl'