Sha256: 30923a1078e20f8ad681eca1e49b80cc649e16983f80172c39733da6f1228bca
Contents?: true
Size: 940 Bytes
Versions: 2
Compression:
Stored size: 940 Bytes
Contents
require 'yaml' require 'optparse' module Sanctify class CliError < StandardError; end class CLI def self.run(argv) args = {} opt_parser = OptionParser.new do |opts| opts.banner = "Usage: sanctify [-r REPO_PATH] [-c CONFIG_PATH]" opts.on("-r REPO", "--repo REPO", "Repo to test") do |repo| args[:repo] = repo end opts.on("-c CONFIG", "--config CONFIG", "Configuration file in YAML") do |config| args[:config] = YAML.load(File.open(config)) end opts.on("-h", "--help", "Prints this help") do puts opts exit end end opt_parser.parse!(argv) if args[:repo].nil? if Dir['.git'].empty? raise Sanctify::CliError, "Repo not specified and current directory not a git repository." else args[:repo] = Dir.pwd end end Scanner.new(args).run end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sanctify-0.1.1 | lib/sanctify/cli.rb |
sanctify-0.1.0 | lib/sanctify/cli.rb |