Blame 0063-cli-add-option-remove-crash-dirs-after-reporting.patch

69165ba
From fa289049950f8c64455e94dd07bec2170a2d28e2 Mon Sep 17 00:00:00 2001
69165ba
From: Matej Habrnal <mhabrnal@redhat.com>
69165ba
Date: Sat, 20 Sep 2014 11:24:25 +0200
69165ba
Subject: [ABRT PATCH 63/66] cli: add option remove crash dirs after reporting
69165ba
69165ba
Add option -d to abrt-cli report which allows delete dump dir after the problem
69165ba
was successfully reported.
69165ba
69165ba
Resolves #1067545
69165ba
69165ba
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
69165ba
Signed-off-by: Jakub Filak <jfilak@redhat.com>
69165ba
---
69165ba
 po/POTFILES.in   |  1 +
69165ba
 src/cli/report.c | 18 ++++++++++++++++--
69165ba
 2 files changed, 17 insertions(+), 2 deletions(-)
69165ba
69165ba
diff --git a/po/POTFILES.in b/po/POTFILES.in
69165ba
index e3f917b..141c73a 100644
69165ba
--- a/po/POTFILES.in
69165ba
+++ b/po/POTFILES.in
69165ba
@@ -51,6 +51,7 @@ src/cli/abrt-cli-core.c
69165ba
 src/cli/abrt-cli.c
69165ba
 src/cli/list.c
69165ba
 src/cli/status.c
69165ba
+src/cli/report.c
69165ba
 
69165ba
 src/plugins/analyze_CCpp.xml.in
69165ba
 src/plugins/analyze_VMcore.xml.in
69165ba
diff --git a/src/cli/report.c b/src/cli/report.c
69165ba
index 3321a78..33d8b44 100644
69165ba
--- a/src/cli/report.c
69165ba
+++ b/src/cli/report.c
69165ba
@@ -26,14 +26,20 @@ int cmd_report(int argc, const char **argv)
69165ba
 {
69165ba
     const char *program_usage_string = _(
69165ba
         "& report [options] DIR..."
69165ba
-        );
69165ba
+    );
69165ba
+
69165ba
+    enum {
69165ba
+        OPT_v = 1 << 0,
69165ba
+        OPT_d = 1 << 1,
69165ba
+    };
69165ba
 
69165ba
     struct options program_options[] = {
69165ba
         OPT__VERBOSE(&g_verbose),
69165ba
+        OPT_BOOL('d', "delete", NULL, _("Remove PROBLEM_DIR after reporting")),
69165ba
         OPT_END()
69165ba
     };
69165ba
 
69165ba
-    parse_opts(argc, (char **)argv, program_options, program_usage_string);
69165ba
+    unsigned opts = parse_opts(argc, (char **)argv, program_options, program_usage_string);
69165ba
     argv += optind;
69165ba
 
69165ba
     if (!argv[0])
69165ba
@@ -58,6 +64,14 @@ int cmd_report(int argc, const char **argv)
69165ba
         int status = report_problem_in_dir(dir_name,
69165ba
                                              LIBREPORT_WAIT
69165ba
                                            | LIBREPORT_RUN_CLI);
69165ba
+
69165ba
+        /* the problem was successfully reported and option is -d */
69165ba
+        if((opts & OPT_d) && (status == 0 || status == EXIT_STOP_EVENT_RUN))
69165ba
+        {
69165ba
+            log(_("Deleting '%s'"), dir_name);
69165ba
+            delete_dump_dir_possibly_using_abrtd(dir_name);
69165ba
+        }
69165ba
+
69165ba
         free(free_me);
69165ba
 
69165ba
         if (status)
69165ba
-- 
69165ba
1.8.3.1
69165ba