]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- work on dbus interface
authorArvin Schnell <aschnell@suse.de>
Fri, 17 Aug 2012 12:52:10 +0000 (14:52 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 17 Aug 2012 12:52:10 +0000 (14:52 +0200)
client/snapper.cc
client/utils/GetOpts.cc

index e16c881409180b9bffbfd6e5890e39a50f0845e5..9bc1d83bbc7d6d508a94633db0bf6dc298e702f2 100644 (file)
@@ -1106,10 +1106,22 @@ log_do(LogLevel level, const string& component, const char* file, const int line
 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()
 {
@@ -1144,6 +1156,8 @@ help()
     help_diff();
     help_undo();
     help_cleanup();
+
+    exit (EXIT_SUCCESS);
 }
 
 
@@ -1217,29 +1231,21 @@ main(int argc, char** argv)
     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);
     }
 
index 16d31ba60dcbae9b1ed9e6ab9088a2496bf93c0b..0fdee9c616d96473355b12ef999947e8418e5424 100644 (file)
@@ -58,7 +58,7 @@ GetOpts::parse(const char* command, const struct option* longopts)
                    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 ':':
@@ -66,7 +66,7 @@ GetOpts::parse(const char* command, const struct option* longopts)
                    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: