21 #include "pism/util/pism_options.hh"
22 #include "pism/util/pism_utilities.hh"
23 #include "pism/pism_config.hh"
25 #include "pism/util/Logger.hh"
30 void show_usage(
const Logger &log,
const std::string &execname,
const std::string &usage) {
32 "%s is a PISM (http://www.pism.io) executable.\n"
33 "Options cheat-sheet:\n",
37 "Parallel run using N processes (typical case): mpiexec -n N %s ...\n"
38 "For more help with PISM:\n"
39 " 1. download PDF User's Manual or read the online version on the website:\n"
40 " http://www.pism.io\n"
41 " 2. read browser for technical details:\n"
42 " http://www.pism.io/doxygen\n"
43 " 3. view issues/bugs at source host: https://github.com/pism/pism/issues\n"
44 " 4. do '%s -help | grep foo' to see PISM and PETSc options with 'foo'.\n"
45 " 5. email for help: uaf-pism@alaska.edu\n",
46 execname.c_str(), execname.c_str());
52 const std::string &execname,
53 const std::vector<std::string> &required_options,
54 const std::string &usage) {
55 const bool keep_running =
false;
56 const bool terminate =
true;
58 log.
message(2,
"%s %s\n", execname.c_str(), pism::revision);
60 if (
options::Bool(
"-version",
"stop after printing print PISM version")) {
71 bool req_absent =
false;
72 for (
const auto &opt : required_options) {
75 log.
error(
"PISM ERROR: option %s required\n", opt.c_str());
void message(int threshold, const char format[],...) const __attribute__((format(printf
Print a message to the log.
void error(const char format[],...) const __attribute__((format(printf
Print an error message to the log.
bool Bool(const std::string &option, const std::string &description)
void show_usage(const Logger &log, const std::string &execname, const std::string &usage)
Print a usage message.
bool show_usage_check_req_opts(const Logger &log, const std::string &execname, const std::vector< std::string > &required_options, const std::string &usage)
In a single call a driver program can provide a usage string to the user and check if required option...