lib/tap/support/configuration.rb in bahuvrihi-tap-0.10.4 vs lib/tap/support/configuration.rb in bahuvrihi-tap-0.10.5
- old
+ new
@@ -117,8 +117,27 @@
self.reader == another.reader &&
self.writer == another.writer &&
self.default(false) == another.default(false)
end
+ def to_optparse_argv
+ argtype = case arg_type
+ when :optional
+ "#{long} [#{arg_name}]"
+ when :switch
+ long(true)
+ when :flag
+ long
+ when :list
+ "#{long} a,b,c"
+ when :mandatory, nil
+ "#{long} #{arg_name}"
+ else
+ raise "unknown arg_type: #{arg_type}"
+ end
+
+ [short, argtype, desc].compact
+ end
+
end
end
end
\ No newline at end of file