@@ -517,12 +517,15 @@ end
517
517
function cli :print_usage (noprint )
518
518
-- print the USAGE heading
519
519
local msg = " Usage: " .. tostring (self .name )
520
- if self .optional [ 1 ] then
521
- msg = msg .. " [OPTIONS] "
520
+ if # self .optional > 0 then
521
+ msg = msg .. " [OPTIONS]"
522
522
end
523
- if self .required [1 ] then
523
+ if # self .required > 0 or self .optargument .maxcount > 0 then
524
+ msg = msg .. " [--]"
525
+ end
526
+ if # self .required > 0 then
524
527
for _ ,entry in ipairs (self .required ) do
525
- msg = msg .. " " .. entry .key .. " "
528
+ msg = msg .. " " .. entry .key
526
529
end
527
530
end
528
531
if self .optargument .maxcount == 1 then
@@ -569,11 +572,11 @@ function cli:print_help(noprint)
569
572
end
570
573
end
571
574
572
- if self .optargument .maxcount > 0 then
575
+ if self .optargument .maxcount > 0 then
573
576
append (self .optargument .key , self .optargument .desc .. " (optional, default: " .. self .optargument .default .. " )" )
574
577
end
575
578
576
- if self .optional [ 1 ] then
579
+ if # self .optional > 0 then
577
580
msg = msg .. " \n OPTIONS: \n "
578
581
579
582
for _ ,entry in ipairs (self .optional ) do
0 commit comments