summaryrefslogtreecommitdiff
path: root/src/help.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/help.cc')
-rw-r--r--src/help.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/help.cc b/src/help.cc
new file mode 100644
index 0000000..18853e1
--- /dev/null
+++ b/src/help.cc
@@ -0,0 +1,59 @@
+// This file is part of Cait <https://github.com/Fuwn/cait>.
+// Copyright (C) 2022-2022 Fuwn <[email protected]>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 3.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Copyright (C) 2022-2022 Fuwn <[email protected]>
+// SPDX-License-Identifier: GPL-3.0-only
+
+#include <thread>
+
+#include "help.hh"
+
+namespace cait {
+
+auto help_message() -> std::string {
+ std::ostringstream help;
+
+ help
+ << "usage: cait [options] [targets...]\n"
+ "\n"
+ "if targets are unspecified, builds the 'default' target (see "
+ "manual).\n"
+ "\n"
+ "options:\n"
+ " --version print cait version (\"" VERSION "\")\n"
+ " -v, --verbose show all command lines while building\n"
+ "\n"
+ " -C DIR change to DIR before doing anything else\n"
+ " -f FILE specify input build file [default=build.cait]\n"
+ "\n"
+ " -j N run N jobs in parallel (0 means infinity) [default="
+ << std::thread::hardware_concurrency() + 2
+ << " on this system]\n"
+ " -k N keep going until N jobs fail (0 means infinity) "
+ "[default=1]\n"
+ " -l N do not start new jobs if the load average is greater "
+ "than N\n"
+ " -n dry run (don't run commands but act like they succeeded)\n"
+ "\n"
+ " -d MODE enable debugging (use '-d list' to list modes)\n"
+ " -t TOOL run a subtool (use '-t list' to list subtools)\n"
+ " terminates toplevel options; further flags are passed to the "
+ "tool\n"
+ " -w FLAG adjust warnings (use '-w list' to list warnings)";
+
+ return help.str();
+}
+
+} // namespace cait