Sha256: aaf74376083eaac28513f933e00c634b0556de6619ba9243e16e76a2a762ba7d

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

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("-s", "--subpath PATH", "Subpath of root to sync") do |v|
          options[:subpath] = 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
        opts.on("-t", "--[no-]threaded", "Run all hosts concurrently") do |v|
          options[:threaded] = v
        end
        opts.on("--timeout TIMEOUT", "Set I/O timeout") do |v|
          options[:timeout] = v
        end
      end.parse!

      options
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rbfs-0.0.10 lib/rbfs/args.rb
rbfs-0.0.9 lib/rbfs/args.rb
rbfs-0.0.8 lib/rbfs/args.rb
rbfs-0.0.7 lib/rbfs/args.rb
rbfs-0.0.6 lib/rbfs/args.rb
rbfs-0.0.5 lib/rbfs/args.rb
rbfs-0.0.4 lib/rbfs/args.rb
rbfs-0.0.3 lib/rbfs/args.rb