|
|
a60cd7 |
From fbcbd0e922e2c7efe62a584fbd76b36fbe0e2952 Mon Sep 17 00:00:00 2001
|
|
|
a60cd7 |
From: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
a60cd7 |
Date: Mon, 8 Sep 2014 13:27:56 +0200
|
|
|
a60cd7 |
Subject: [ABRT PATCH 56/66] cli: make consistent commands in abrt-cli
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Add abbreviations to the client's parametres.
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Related to rhbz#1066501
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Conflicts:
|
|
|
a60cd7 |
src/cli/abrt-cli.c
|
|
|
a60cd7 |
---
|
|
|
a60cd7 |
doc/abrt-cli.txt | 2 +-
|
|
|
a60cd7 |
src/cli/abrt-cli.c | 20 +++++++++++---------
|
|
|
a60cd7 |
src/cli/builtin-cmd.h | 2 +-
|
|
|
a60cd7 |
src/cli/rm.c | 2 +-
|
|
|
a60cd7 |
4 files changed, 14 insertions(+), 12 deletions(-)
|
|
|
a60cd7 |
|
|
|
a60cd7 |
diff --git a/doc/abrt-cli.txt b/doc/abrt-cli.txt
|
|
|
a60cd7 |
index 792e781..1c95655 100644
|
|
|
a60cd7 |
--- a/doc/abrt-cli.txt
|
|
|
a60cd7 |
+++ b/doc/abrt-cli.txt
|
|
|
a60cd7 |
@@ -9,7 +9,7 @@ SYNOPSIS
|
|
|
a60cd7 |
--------
|
|
|
a60cd7 |
'abrt-cli' list [-vdf] [DIR]...
|
|
|
a60cd7 |
|
|
|
a60cd7 |
-'abrt-cli' rm [-v] DIR...
|
|
|
a60cd7 |
+'abrt-cli' remove [-v] DIR...
|
|
|
a60cd7 |
|
|
|
a60cd7 |
'abrt-cli' report [-v] DIR...
|
|
|
a60cd7 |
|
|
|
a60cd7 |
diff --git a/src/cli/abrt-cli.c b/src/cli/abrt-cli.c
|
|
|
a60cd7 |
index a1ab7ec..c04c132 100644
|
|
|
a60cd7 |
--- a/src/cli/abrt-cli.c
|
|
|
a60cd7 |
+++ b/src/cli/abrt-cli.c
|
|
|
a60cd7 |
@@ -20,14 +20,15 @@
|
|
|
a60cd7 |
#include "libabrt.h"
|
|
|
a60cd7 |
#include "builtin-cmd.h"
|
|
|
a60cd7 |
|
|
|
a60cd7 |
-#define USAGE_OPTS_WIDTH 12
|
|
|
a60cd7 |
+#define USAGE_OPTS_WIDTH 16
|
|
|
a60cd7 |
#define USAGE_GAP 2
|
|
|
a60cd7 |
|
|
|
a60cd7 |
/* TODO: add --pager(default) and --no-pager */
|
|
|
a60cd7 |
|
|
|
a60cd7 |
-#define CMD(NAME, help) { #NAME, cmd_##NAME , (help) }
|
|
|
a60cd7 |
+#define CMD(NAME, ABBREV, help) { #NAME, ABBREV, cmd_##NAME , (help) }
|
|
|
a60cd7 |
struct cmd_struct {
|
|
|
a60cd7 |
const char *cmd;
|
|
|
a60cd7 |
+ const char *abbrev;
|
|
|
a60cd7 |
int (*fn)(int, const char **);
|
|
|
a60cd7 |
const char *help;
|
|
|
a60cd7 |
};
|
|
|
a60cd7 |
@@ -41,6 +42,7 @@ static void list_cmds_help(const struct cmd_struct *commands)
|
|
|
a60cd7 |
|
|
|
a60cd7 |
pos = fprintf(stderr, " ");
|
|
|
a60cd7 |
pos += fprintf(stderr, "%s", p->cmd);
|
|
|
a60cd7 |
+ pos += fprintf(stderr, ", %s", p->abbrev);
|
|
|
a60cd7 |
|
|
|
a60cd7 |
if (pos <= USAGE_OPTS_WIDTH)
|
|
|
a60cd7 |
pad = USAGE_OPTS_WIDTH - pos;
|
|
|
a60cd7 |
@@ -110,7 +112,7 @@ static void handle_internal_command(int argc, const char **argv,
|
|
|
a60cd7 |
|
|
|
a60cd7 |
for (const struct cmd_struct *p = commands; p->cmd; ++p)
|
|
|
a60cd7 |
{
|
|
|
a60cd7 |
- if (strcmp(p->cmd, cmd) != 0)
|
|
|
a60cd7 |
+ if (strcmp(p->cmd, cmd) != 0 && strcmp(p->abbrev, cmd) != 0)
|
|
|
a60cd7 |
continue;
|
|
|
a60cd7 |
|
|
|
a60cd7 |
exit(p->fn(argc, argv));
|
|
|
a60cd7 |
@@ -143,12 +145,12 @@ int main(int argc, const char **argv)
|
|
|
a60cd7 |
);
|
|
|
a60cd7 |
|
|
|
a60cd7 |
const struct cmd_struct commands[] = {
|
|
|
a60cd7 |
- CMD(list, _("List not yet reported problems [in DIRs]")),
|
|
|
a60cd7 |
- CMD(rm, _("Remove problem directory DIR")),
|
|
|
a60cd7 |
- CMD(report, _("Analyze and report problem data in DIR")),
|
|
|
a60cd7 |
- CMD(info, _("Print information about DIR")),
|
|
|
a60cd7 |
- CMD(status, _("Print the count of the recent crashes")),
|
|
|
a60cd7 |
- {NULL, NULL, NULL}
|
|
|
a60cd7 |
+ CMD(list, "ls", _("List problems [in DIRs]")),
|
|
|
a60cd7 |
+ CMD(remove, "rm", _("Remove problem directory DIR")),
|
|
|
a60cd7 |
+ CMD(report, "e",_("Analyze and report problem data in DIR")),
|
|
|
a60cd7 |
+ CMD(info, "i", _("Print information about DIR")),
|
|
|
a60cd7 |
+ CMD(status, "st",_("Print the count of the recent crashes")),
|
|
|
a60cd7 |
+ {NULL, NULL, NULL, NULL}
|
|
|
a60cd7 |
};
|
|
|
a60cd7 |
|
|
|
a60cd7 |
migrate_to_xdg_dirs();
|
|
|
a60cd7 |
diff --git a/src/cli/builtin-cmd.h b/src/cli/builtin-cmd.h
|
|
|
a60cd7 |
index 491760b..18588e1 100644
|
|
|
a60cd7 |
--- a/src/cli/builtin-cmd.h
|
|
|
a60cd7 |
+++ b/src/cli/builtin-cmd.h
|
|
|
a60cd7 |
@@ -21,7 +21,7 @@
|
|
|
a60cd7 |
#define _BUILTIN_CMD_H_
|
|
|
a60cd7 |
|
|
|
a60cd7 |
extern int cmd_list(int argc, const char **argv);
|
|
|
a60cd7 |
-extern int cmd_rm(int argc, const char **argv);
|
|
|
a60cd7 |
+extern int cmd_remove(int argc, const char **argv);
|
|
|
a60cd7 |
extern int cmd_report(int argc, const char **argv);
|
|
|
a60cd7 |
extern int cmd_info(int argc, const char **argv);
|
|
|
a60cd7 |
extern int cmd_status(int argc, const char **argv);
|
|
|
a60cd7 |
diff --git a/src/cli/rm.c b/src/cli/rm.c
|
|
|
a60cd7 |
index 8f185a4..fe458ff 100644
|
|
|
a60cd7 |
--- a/src/cli/rm.c
|
|
|
a60cd7 |
+++ b/src/cli/rm.c
|
|
|
a60cd7 |
@@ -25,7 +25,7 @@
|
|
|
a60cd7 |
* add -q, --quite
|
|
|
a60cd7 |
*/
|
|
|
a60cd7 |
|
|
|
a60cd7 |
-int cmd_rm(int argc, const char **argv)
|
|
|
a60cd7 |
+int cmd_remove(int argc, const char **argv)
|
|
|
a60cd7 |
{
|
|
|
a60cd7 |
const char *program_usage_string = _(
|
|
|
a60cd7 |
"& rm [options] DIR..."
|
|
|
a60cd7 |
--
|
|
|
a60cd7 |
1.8.3.1
|
|
|
a60cd7 |
|