On Wednesday 24 of April 2013 17:15:51 Jiri Moskovcak wrote:
Signed-off-by: Jiri Moskovcak <jmoskovc(a)redhat.com>
diff --git a/src/cli/abrt-cli.c b/src/cli/abrt-cli.c
index f4b0e7e..bc3b8c3 100644
--- a/src/cli/abrt-cli.c
+++ b/src/cli/abrt-cli.c
@@ -147,6 +147,7 @@ int main(int argc, const char **argv)
CMD(rm, _("Remove problem directory DIR")),
CMD(report, _("Analyze and report problem data in DIR")),
CMD(info, _("Print information about DIR")),
+ CMD(status, _("Print information about DIR")),
Copy paste ...
{NULL, NULL, NULL}
};
diff --git a/src/cli/status.c b/src/cli/status.c
new file mode 100644
index 0000000..7801c7c
--- /dev/null
+++ b/src/cli/status.c
@@ -0,0 +1,52 @@
+/*
+ Copyright (C) 2011 ABRT Team
+ Copyright (C) 2011 RedHat inc.
2013
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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, write to the Free Software Foundation,
Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include <unistd.h>
+#include <sys/types.h>
+#include "problem_api.h"
+
+int cmd_status(int argc, const char **argv)
+{
+ const char *program_usage_string = _(
+ "& list [options] [DIR]..."
This command has no options and its name is 'status'.
+ );
+
+
+ struct options program_options[] = {
+ OPT__VERBOSE(&g_verbose),
+ OPT_GROUP(""),
+ OPT_END()
+ };
+
+ parse_opts(argc, (char **)argv, program_options, program_usage_string);
+ argv += optind;
+
+ GList *problem_dir_list = NULL;
+ while (*argv)
+ problem_dir_list = g_list_append(problem_dir_list,
xstrdup(*argv++)); +
+ int problem_count = get_problems_count(problem_dir_list);
+
+ /* show only if there is at least 1 problem or user set the -v */
+ if (problem_count > 0 || g_verbose > 0)
+ printf(_("ABRT has detected '%i' problem(s). (For more info run: $
abrt-cli list --full)\n"), problem_count); +
It could be nice to enable colorized output :)
list_free_with_free(problem_dir_list);
+
+ return 0;
+}
\ No newline at end of file