clipp icon indicating copy to clipboard operation
clipp copied to clipboard

documentation formatting wrong for groups with only value options

Open NikolausDemmel opened this issue 3 years ago • 1 comments

Code:

auto cli = (option("--a") & value("A") % "help a", option("-b") & value("B") % "help b") % "group 1";
std::cout << make_man_page(cli, "test");

Expected:

SYNOPSIS
        test [--a <A>] [-b <B>]

OPTIONS
        group 1
            <A>     help a
            <B>     help b

Actual:

SYNOPSIS
        test [--a <A>] [-b <B>]

OPTIONS
        [--a <A>] [-b <B>]
                    group 1

This works fine:

auto cli = (option("--a") & value("A") % "help a", option("-b") % "help b") % "group 1";
std::cout << make_man_page(cli, "test");
SYNOPSIS
        test [--a <A>] [-b]

OPTIONS
        group 1
            <A>     help a
            -b      help b

live example: https://wandbox.org/permlink/m9OeLGfP7ZDiOjD1

NikolausDemmel avatar Oct 08 '20 23:10 NikolausDemmel

Looks like this workaround produces the expected output:

auto cli = (option("--a") & value("A") % "help a", option("-b") & value("B") % "help b", option("") % "dummy") % "group 1";

Edit: except for some maybe unwanted newlines.

NikolausDemmel avatar Oct 08 '20 23:10 NikolausDemmel