Sha256: 5b68caf2d78c400bc87346cc249c6550a524b0d74fd500d22ce51c2145ab4927

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

require 'optparse'

module Rbfs
  class Args
    def parse
      options = {}

      OptionParser.new do |opts|
        opts.banner = "Usage: rbfs [options]"
        opts.on("-c", "--config FILE", "Configuration file") do |v|
          options[:config] = v
        end
        opts.on("-h", "--hosts FILE", "Hosts file") do |v|
          options[:hosts] = v
        end
        opts.on("-r", "--root ROOT", "Root path to sync") do |v|
          options[:root] = v
        end
        opts.on("-v", "--[no-]verbose", "Print extra debugging info") do |v|
          options[:verbose] = v
        end
        opts.on("-d", "--dry", "Test config settings") do |v|
          options[:dry] = v
        end
      end.parse!

      options
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbfs-0.0.2 lib/rbfs/args.rb