Sha256: 89087e6c085bbea6a05d533c4c75581250a92e79292360f628b39193e5c5f21c
Contents?: true
Size: 981 Bytes
Versions: 1
Compression:
Stored size: 981 Bytes
Contents
# frozen_string_literal: true module Joi class CLI attr_reader :argv def initialize(argv = ARGV.dup) @argv = argv end def options @options ||= { rails: File.file?(File.join(Dir.pwd, ".rails")), bundler: true } end def start OptionParser.new do |parser| parser.banner = "Usage: joi [OPTIONS]" parser.version = VERSION parser.on("--[no-]bundler", "-b", "Use bundler to run commands.") do |bundler| options[:bundler] = bundler end parser.on("--rails", "Use this in Rails projects.") do |rails| options[:rails] = rails end parser.on("-h", "--help", "Prints this help") do puts parser exit end parser.parse!(argv) runner = Runner.new(options: options) trap("INT") { runner.run_all } trap("QUIT") { exit! } runner.start end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
joi-0.0.2 | lib/joi/cli.rb |