Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse failing on otherwise valid arguments #43

Open
Qix- opened this issue Feb 20, 2020 · 1 comment
Open

Parse failing on otherwise valid arguments #43

Qix- opened this issue Feb 20, 2020 · 1 comment

Comments

@Qix-
Copy link

Qix- commented Feb 20, 2020

	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-
Copy link
Author

Qix- commented Feb 20, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant