Class: RFuseFlacToMovFSOpts
- Inherits:
-
Object
- Object
- RFuseFlacToMovFSOpts
- Defined in:
- lib/rfuse_flac_to_mov_fs_opts.rb
Class Method Summary collapse
-
.parse(args) ⇒ Object
Return a structure describing the options.
Class Method Details
.parse(args) ⇒ Object
Return a structure describing the options.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/rfuse_flac_to_mov_fs_opts.rb', line 11 def self.parse(args) @VERSION = "0.0.2" # The options specified on the command line will be collected in *options*. # We set default values here. = OpenStruct.new .verbose = false .mountpoint = "" .input = "" opts = OptionParser.new do |opts| opts. = "Usage: #{__FILE__} [options]" opts.separator "" opts.separator "Common options:" # No argument, shows at tail. This will print an options summary. opts.on("-h", "--help", "Show this message") do puts opts exit end # Another typical switch to print the version. opts.on("--version", "Show version") do #puts OptionParser::Version.join('.') puts "Version #{@VERSION}" exit end # Boolean switch. #opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| # options.verbose = v #end opts.separator "" opts.separator "Specific options:" # Cast 'delay' argument to a Float. opts.on("--mountpoint path", String, "Root of new Filesystem") do |n| .mountpoint = n end opts.on("--input N", String, "Folder FS will point to") do |n| .input = File.( n ) end end .leftovers = opts.parse!(args) if (.mountpoint == "") and (.input == "") and (.leftovers.size==2) .mountpoint = .leftovers[0] .input = File.( .leftovers[1] ) end return end |