I tried running cppfront --help
, and got the following output:
--help...
--help: error: source filename must end with .cpp2 or .h2: --help
I expected using --help
to cause the cppfront executable to print its help message / doc string. --help
is a pretty conventional flag / argument for that purpose.
The correct flag to use to get cppfront to print its help doc is -help
(one leading dash instead of two). You can also use -?
. And flags can be led with /
instead of -
too.
Once you know that and print the help string, you'll see that cppfront doesn't follow the relatively common pattern of using two dashes for long-form commandline arguments / flags, and instead uses a single leading dash for everything. I suppose that's in line with a lot of GCC's arguments / flags, but even GCC uses two dashes for --help
and has no -help
.
The source code for printing the help message can (at the time of this writing) be found in source/common.h (the print_help
function).
If you run cppfront with no arguments, it'll actually say the following:
cppfront: error: no input files (try -help)
There's also a line of code in cppfront that will print a message referencing -help
if you pass an argument that takes a value but don't pass a value:
print("Missing argument to option " + arg->text + " (try -help)\n");