Skip to content

Commit

Permalink
Amalgamate.cpp: rewrite usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rindeal authored May 19, 2024
1 parent 9b9102f commit c2cf0fa
Showing 1 changed file with 50 additions and 62 deletions.
112 changes: 50 additions & 62 deletions Amalgamate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,71 +675,59 @@ class Amalgamator

//==============================================================================

void print_usage (int, char* argv[])
{
void print_usage(int, char* argv[]) {
const String name (argv[0]);

std::cout << "\n";
std::cout << " NAME" << "\n";
std::cout << " " << "\n";
std::cout << " " << name << " - produce an amalgamation of C/C++ source files." << "\n";
std::cout << " " << "\n";
std::cout << " SYNOPSIS" << "\n";
std::cout << " " << "\n";
std::cout << " " << name << " [-s] [-t]" << "\n";
std::cout << " [-w {wildcards}]" << "\n";
std::cout << " [-f {file|macro}]..." << "\n";
std::cout << " [-p {file|macro}]..." << "\n";
std::cout << " [-d {name}={file}]..." << "\n";
std::cout << " [-i {dir}]..." << "\n";
std::cout << " [-h]" << "\n";
std::cout << " [-v]" << "\n";
std::cout << " {inputFile} {outputFile}" << "\n";
std::cout << " " << "\n";
std::cout << " DESCRIPTION" << "\n";
std::cout << " " << "\n";
std::cout << " Produces an amalgamation of {inputFile} by replacing #include statements with" << "\n";
std::cout << " the contents of the file they refer to. This replacement will only occur if" << "\n";
std::cout << " the file was located in the same directory, or one of the additional include" << "\n";
std::cout << " paths added with the -i option." << "\n";
std::cout << " " << "\n";
std::cout << " Files included in angle brackets (system includes) are only inlined if the" << "\n";
std::cout << " -s option is specified." << "\n";
std::cout << " " << "\n";
std::cout << " If an #include line contains a macro instead of a string literal, the list" << "\n";
std::cout << " of definitions provided through the -d option is consulted to convert the" << "\n";
std::cout << " macro into a string." << "\n";
std::cout << " " << "\n";
std::cout << " A file will only be inlined once, with subsequent #include lines for the same" << "\n";
std::cout << " file silently ignored, unless the -f option is specified for the file." << "\n";
std::cout << " " << "\n";
std::cout << " OPTIONS" << "\n";
std::cout << " " << "\n";
std::cout << " -s Process #include lines containing angle brackets (i.e." << "\n";
std::cout << " system includes). Normally these are not inlined." << "\n";
std::cout << " " << "\n";
std::cout << " -t Convert spaces into tabs." << "\n";
std::cout << " " << "\n";
std::cout << " -w {wildcards} Specify a comma separated list of file name patterns to" << "\n";
std::cout << " match when deciding to inline (assuming the file can be" << "\n";
std::cout << " located). The default setting is \"*.cpp;*.c;*.hpp;*.h\"." << "\n";
std::cout << " " << "\n";
std::cout << " -f {file|macro} Force reinclusion of the specified file or macro on" << "\n";
std::cout << " all appearances in #include lines." << "\n";
std::cout << " " << "\n";
std::cout << " -p {file|macro} Prevent reinclusion of the specified file or macro on" << "\n";
std::cout << " subsequent appearances in #include lines." << "\n";
std::cout << " " << "\n";
std::cout << " -d {name}={file} Use {file} for macro {name} if it appears in an #include" << "\n";
std::cout << " line." << "\n";
std::cout << " " << "\n";
std::cout << " -i {dir} Additionally look in the specified directory for files when" << "\n";
std::cout << " processing #include lines." << "\n";
std::cout << " " << "\n";
std::cout << " -h Print help and exit" << "\n";
std::cout << " " << "\n";
std::cout << " -v Verbose output mode" << "\n";
std::cout << "\n";
std::cout << "NAME\n";
std::cout << " " << name << " - Produce an amalgamation of C/C++ source files.\n\n";
std::cout << "SYNOPSIS\n";
std::cout << " " << name << " [-s] [-t] [-w {wildcards}] [-f {file|macro}]...\n";
std::cout << " [-p {file|macro}]... [-d {name}={file}]... [-i {dir}]...\n";
std::cout << " {inputFile} {outputFile}\n\n";
std::cout << "EXAMPLES\n";
std::cout << " " << name << " INPUT.h OUTPUT.h\n";
std::cout << " This command will produce an amalgamation of INPUT.h into OUTPUT.h.\n\n";
std::cout << " " << name << " -w \"include/*.h\" OUTPUT.h\n";
std::cout << " This command will match files with .h extension in the include directory\n";
std::cout << " and produce an amalgamation into OUTPUT.h.\n\n";
std::cout << "DESCRIPTION\n";
std::cout << " Produces an amalgamation of {inputFile} by replacing #include statements\n";
std::cout << " with the contents of the file they refer to. This replacement will only\n";
std::cout << " occur if the file was located in the same directory, or one of the\n";
std::cout << " additional include paths added with the -i option.\n\n";
std::cout << " Files included in angle brackets (system includes) are only inlined if\n";
std::cout << " the -s option is specified.\n\n";
std::cout << " If an #include line contains a macro instead of a string literal, the\n";
std::cout << " list of definitions provided through the -d option is consulted to\n";
std::cout << " convert the macro into a string.\n\n";
std::cout << " A file will only be inlined once, with subsequent #include lines for the\n";
std::cout << " same file silently ignored, unless the -f option is specified for the\n";
std::cout << " file.\n\n";
std::cout << "OPTIONS\n";
std::cout << " -s Process #include lines containing angle brackets (i.e.,\n";
std::cout << " system includes). Normally these are not inlined.\n\n";
std::cout << " -t Convert spaces into tabs.\n\n";
std::cout << " -w {wildcards} Specify a comma-separated list of file name patterns to\n";
std::cout << " match when deciding to inline (assuming the file can be\n";
std::cout << " located). The default setting is \"*.cpp;*.c;*.hpp;*.h\".\n\n";
std::cout << " -f {file|macro} Force reinclusion of the specified file or macro on all\n";
std::cout << " appearances in #include lines.\n\n";
std::cout << " -p {file|macro} Prevent reinclusion of the specified file or macro on\n";
std::cout << " subsequent appearances in #include lines.\n\n";
std::cout << " -d {name}={file} Use {file} for macro {name} if it appears in an #include\n";
std::cout << " line.\n\n";
std::cout << " -i {dir} Additionally look in the specified directory for files\n";
std::cout << " when processing #include lines.\n\n";
std::cout << " -h Print help and exit.\n\n";
std::cout << " -v Verbose output mode.\n\n";
std::cout << "AUTHORS\n";
std::cout << " Copyright (C) 2012 Vinnie Falco\n";
std::cout << " Copyright (C) 2016-2024 Jan Chren\n";
std::cout << " Amalgamate is provided under the terms of the MIT license.\n";
std::cout << " Amalgamate embeds juce_core module of JUCE, licensed separately under ISC license.\n\n";
std::cout << "WWW\n";
std::cout << " https://github.com/rindeal/Amalgamate\n\n";
}

int main (int argc, char* argv[])
Expand Down

0 comments on commit c2cf0fa

Please sign in to comment.