Skip to content

Commit

Permalink
Use command description if short one is not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-zherikov committed May 11, 2022
1 parent ab8195b commit 6b79f5a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion examples/sub_commands/advanced/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ auto filter(R)(R numbers, Filter filt)
@(Command("sum")
.Usage("%(PROG) [<number>...]")
.Description("Print sum of the numbers")
.ShortDescription("Print the sum")
)
struct SumCmd
{
Expand Down
2 changes: 1 addition & 1 deletion source/argparse.d
Original file line number Diff line number Diff line change
Expand Up @@ -3954,7 +3954,7 @@ private void printHelp(Output)(auto ref Output output, in CommandInfo[] commands
//if(_.hideFromHelp)
// return Result.init;

return Result(_.names.join(","), _.shortDescription);
return Result(_.names.join(","), _.shortDescription.length > 0 ? _.shortDescription : _.description);
}).array;

immutable maxInvocationWidth = cmds.map!(_ => _.invocation.length).maxElement;
Expand Down

0 comments on commit 6b79f5a

Please sign in to comment.