ruby3: Opt.new: optional default - CMD.opt needs support.

This commit is contained in:
Denis Knauf 2021-12-31 13:55:27 +01:00
parent a00149ce6a
commit 616989e96a
2 changed files with 3 additions and 2 deletions

View file

@ -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"

View file

@ -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