RubyGems Navigation menu

baf 0.15.1

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

Gemfile:
=

安裝:
=

版本列表:

  1. 0.15.1 July 06, 2022 (9.5 KB)
  2. 0.15.0 June 12, 2022 (9.5 KB)
  3. 0.14.1 November 04, 2020 (8.0 KB)
  4. 0.14.0 October 22, 2017 (8.0 KB)
  5. 0.13.0 October 22, 2017 (8.0 KB)
顯示所有版本(共 23)

Development 相依性套件 (3):

cucumber ~> 3.2
rake >= 0
rspec ~> 3.11

擁有者:

推送者:

作者:

  • Thibault Jouan

SHA 256 總和檢查碼:

=

總下載次數 51,909

這個版本 1,070

版本发布:

授權:

BSD-3-Clause

Ruby 版本需求: >= 0

相關連結: