module

CLI

To use the cli macro, include the CLI module into you code.

include CLI

Then call the macro mapping flags and subcommands to methods. Be sure to pass the macro ARGV, for production use.

def run_cli(argv=ARGV)
  cli argv, {
    "-o --output": set_output(String),
    "-h --help": show_help;
  }
end

To use the #ask method be sure to include it directly.

require "cli/ask"

ans = "Do you wanna? [Y/n]", "Y"

NOTE: This is an early version, so please report any edge cases that need to be shored up, and offer suggestions for improvement. Thanks.

Constants

VERSION = "0.2.0"

Instance methods

ask(prompt = nil, default_answer = nil)
Source

Macros

cli(targs, topts)

The cli macro in which the arguments array to parse must be passed.

Source