Sign in Sign up
rubygems

baf

== Baf baf helps writing an user acceptance test suite with a dedicated library and cucumber steps. It can run and wait for programs in a modified environment, verify the exit status, the output streams and other side effects. It also supports interactive programs and writing to their standard input. Then, it provides a DSL to write the CLI: require 'baf/cli' module MyProgram class CLI < Baf::CLI def setup flag_version '0.1.2'.freeze option :c, :config, 'config', 'specify config file' do |path| @config_path = path end end def run usage! unless arguments.any? puts 'arguments: %s' % arguments puts 'config: %s' % @config_path if @config_path end end end MyProgram::CLI.run ARGV Which behaves this way: % ./my_program Usage: my_program [options] options: -c, --config config specify config file -h, --help print this message -V, --version print version zsh: exit 64 ./my_program % ./my_program --wrong-arg Usage: my_program [options] options: -c, --config config specify config file -h, --help print this message -V, --version print version zsh: exit 64 ./my_program --wrong-arg % ./my_program foo arguments ["foo"] % ./my_program -c some_file foo arguments ["foo"] config path some_file

Activity

Latest release
4y ago
Total releases
23
Cadence
~12 days
Last 12 months
0

Details

License
BSD-3-Clause
First release
Feb 22, 2016
Releases
Version Released
0.15.1 patch
0.15.0 minor
0.14.1 patch
0.13.0 minor
0.14.0 minor
0.12.0 minor
0.11.0 minor
0.10.0 minor
0.9.1 patch
0.9.0 minor
0.7.0 minor
0.8.0 minor
0.6.2 patch
0.6.1 patch
0.5.0 minor
0.6.0 minor
0.4.0 minor
0.2.1 patch
0.2.0 minor
0.1.1 patch
0.1.0 minor
0.0.3 patch
0.0.2 initial