ruby3: Opt.new: optional default - CMD.opt needs support.
This commit is contained in:
parent
a00149ce6a
commit
616989e96a
|
@ -3,6 +3,7 @@
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'shellwords'
|
require 'shellwords'
|
||||||
require 'stringio'
|
require 'stringio'
|
||||||
|
require 'ipaddr'
|
||||||
require_relative '../lib/dencli'
|
require_relative '../lib/dencli'
|
||||||
|
|
||||||
cli = DenCli.new :example, "This is an example for generate a DenCli-API"
|
cli = DenCli.new :example, "This is an example for generate a DenCli-API"
|
||||||
|
|
|
@ -217,8 +217,8 @@ class DenCli::CMD
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def opt name, opt, *args, desc, &conv
|
def opt name, opt, *args, desc, default: NilClass, &conv
|
||||||
r = Opt.new( self, name, opt, *args, desc, &conv)
|
r = Opt.new( self, name, opt, *args, desc, default: default, &conv)
|
||||||
@options[r.name] = r
|
@options[r.name] = r
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue