bool
log_query(LogLevel level, const string& component)
{
- return level != DEBUG;
+ return level == ERROR;
}
+void usage() __attribute__ ((__noreturn__));
+
+void
+usage()
+{
+ cerr << "Try 'snapper --help' for more information." << endl;
+ exit(EXIT_FAILURE);
+}
+
+
+void help() __attribute__ ((__noreturn__));
+
void
help()
{
help_diff();
help_undo();
help_cleanup();
+
+ exit (EXIT_SUCCESS);
}
if ((opt = opts.find("help")) != opts.end())
{
help();
- exit(EXIT_SUCCESS);
}
if (!getopts.hasArgs())
{
cerr << _("No command provided.") << endl
- << _("Try 'snapper help' for more information.") << endl;
+ << _("Try 'snapper --help' for more information.") << endl;
exit(EXIT_FAILURE);
}
const char* command = getopts.popArg();
-
- if (strcmp(command, "help") == 0)
- {
- help();
- exit(EXIT_SUCCESS);
- }
-
map<string, cmd_fnc>::const_iterator cmd = cmds.find(command);
if (cmd == cmds.end())
{
cerr << sformat(_("Unknown command '%s'."), command) << endl
- << _("Try 'snapper help' for more information.") << endl;
+ << _("Try 'snapper --help' for more information.") << endl;
exit(EXIT_FAILURE);
}
cerr << sformat(_("Unknown global option '%s'."), argv[optind - 1]) << endl;
else
cerr << sformat(_("Unknown option '%s' for command '%s'."), argv[optind - 1], command) << endl;
- cerr << _("Try 'snapper help' for more information.") << endl;
+ cerr << _("Try 'snapper --help' for more information.") << endl;
exit(EXIT_FAILURE);
case ':':
cerr << sformat(_("Missing argument for global option '%s'."), argv[optind - 1]) << endl;
else
cerr << sformat(_("Missing argument for command option '%s'."), argv[optind - 1]) << endl;
- cerr << _("Try 'snapper help' for more information.") << endl;
+ cerr << _("Try 'snapper --help' for more information.") << endl;
exit(EXIT_FAILURE);
default: