clipp icon indicating copy to clipboard operation
clipp copied to clipboard

Parse failing on otherwise valid arguments

Open Qix- opened this issue 4 years ago • 1 comments

	auto compress = (
		command("compress").set(sc, subcommand::COMPRESS)
		| command("decompress").set(sc, subcommand::DECOMPRESS)
	) % "(de)compress stdin to stdout";

	auto convert = (
		command("convert").set(sc, subcommand::CONVERT),
		value("input.vox", in_path),
		value("output.tox", out_path)
	) % "convert a .VOX scene to .TOX asset";

	auto info = (
		command("info").set(sc, subcommand::INFO),
		value("input.tox", in_path)
	) % "show information about a .TOX asset";

	auto verbose_flag = option("-v", "--verbose").set(verbose, true)
		% "enable verbose output";
	auto help_flag = option("--help").set(help, true)
		% "show this help message";

	auto cli = one_of(
		(
			verbose_flag,
			one_of(
				compress,
				convert,
				info
			)
		),
		help_flag
	);

With the above, I get the following manpage output (looks 100% correct):

SYNOPSIS
        tox [-v] (compress|decompress)
        tox [-v] convert <input.vox> <output.tox>
        tox [-v] info <input.tox>
        tox --help

OPTIONS
        -v, --verbose
                    enable verbose output

        compress|decompress
                    (de)compress stdin to stdout

        convert <input.vox> <output.tox>
                    convert a .VOX scene to .TOX asset

        info <input.tox>
                    show information about a .TOX asset

        --help      show this help message

However, only compress and decompress work; convert and info cause clipp to fail at the parsing step.

Seems like a bug - is that the case? Or is there some sort of workaround for this?

Qix- avatar Feb 20 '20 22:02 Qix-

Workaround is to split out the compress and decompress commands into two separate values and include them at the top level one_of group instead of nested group.

Still wish the way I have it above would work, though.

Qix- avatar Feb 20 '20 23:02 Qix-