summaryrefslogtreecommitdiff
path: root/src/help.cc
blob: 18853e1b33728b2798796ee9c38383b3f5648683 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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