Runfile - If Rake and Docopt had a baby

Gem Travis Code Climate Gemnasium Gem


A beautiful command line application framework.
Rake-inspired, Docopt inside.


Runfile lets you create command line applications in a way similar to Rake, but with the full power of Docopt command line options.

You create a Runfile, and execute commands with run command arguments -and --flags.

Runfile Demo

Learn More in the Wiki


Install

$ gem install runfile

Quick Start

$ run new        # create a new Runfile
$ run --help     # show the usage patterns
$ vi Runfile     # edit the Runfile

Example

The most minimal Runfile looks like this:

usage  "greet <name>"
action :greet do |args|
    puts "Hello #{args['<name>']}" 
end

You can then run it by executing this command:

$ run greet Luke
Hello Luke

Executing run without parameters, will show the usage patterns:

$ run
Usage:
  run greet <name>
  run (-h|--help|--version)

Executing run --help will show the full help document (docopt)

$ run --help
Runfile 0.0.0

Usage:
  run greet <name>
  run (-h|--help|--version)

Options:
  -h --help
      Show this screen

  --version
      Show version

Runfile per project or global Runfiles

In addition to the per project Runfile files, it is also possible to create global runfiles that are accessible to you only or to anybody on the system.

When you execute run, we will look for files in this order:

  • Runfile in the current directory
  • *.runfile in the current directory
  • ~/runfile/**/*.runfile
  • /etc/runfile/**/*.runfile

When you execute run!, we will ignore any local Runfile and only search for global (named) runfiles.

Read more in the Runfile Location and Filename wiki page

Documentation