#!/usr/bin/env ruby
-require 'Maasha/biopieces'
-require 'getoptlong'
+require 'optparse'
+require 'pp'
-options = GetoptLong.new(
- [ '--help', '-?', GetoptLong::NO_ARGUMENT ],
- [ '--stream_in', '-I', GetoptLong::REQUIRED_ARGUMENT ],
- [ '--stream_out', '-O', GetoptLong::REQUIRED_ARGUMENT ],
- [ '--verbose', '-v', GetoptLong::NO_ARGUMENT ]
-)
+options = {}
-if ARGV.length == 0 then
- biopiece = $0.split( "/" ).last
- exec "print_wiki --data_in #{ ENV[ 'BP_DIR' ] }/bp_usage/#{ biopiece }.wiki"
-end
+optparse = OptionParser.new do |opts|
+ opts.on( '-?', '--help', 'Display this screen' ) do
+ biopiece = $0.split( "/" ).last
+ exec "print_wiki --data_in #{ ENV[ 'BP_DIR' ] }/bp_usage/#{ biopiece }.wiki --help"
+ exit
+ end
+
+ opts.on( '-v', '--verbose' ) do
+ options[ :verbose ] = true
+ end
+
+ opts.on( '-I', '--stream_in FILE', Time ) do |arg|
+ options[:stream_in] = arg
+ end
-options.each do | opt, arg |
- puts "option: #{ opt } argument: #{ arg }"
-
- case opt
- when '--help'
- biopiece = $0.split( "/" ).last
- exec "print_wiki --data_in #{ ENV[ 'BP_DIR' ] }/bp_usage/#{ biopiece }.wiki --help"
- when '--stream_in'
- puts "Stream in"
- stream = File.open( arg )
- when '--stream_out'
- puts "Stream out"
- when '--verbose'
- puts "blababnlbalbalbalbalab"
- end
+# opts.on( '-I', '--stream_in FILE', "Mandatory argument" ) do |arg|
+# options[:stream_in] = arg
+# end
+
+ opts.on( '-O', '--stream_in FILE', "Mandatory argument" ) do |arg|
+ options[:stream_out] = arg
+ end
end
-bp_stream = BioPieces.new( "test.stream" )
+optparse.parse!
+
+pp "Options:", options
+pp "ARGV:", ARGV
-puts bp_stream.record_get
+if ARGV.length == 0 then
+ biopiece = $0.split( "/" ).last
+ exec "print_wiki --data_in #{ ENV[ 'BP_DIR' ] }/bp_usage/#{ biopiece }.wiki"
+end
# ---- Adding the mandatory arguments to the arg_list ----
push @{ $arg_list }, (
-
{ long => 'help', short => '?', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
{ long => 'stream_in', short => 'I', type => 'file!', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
{ long => 'stream_out', short => 'O', type => 'file', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },