From fe5829c9e07df94dfcd492d20bc47b168dc2c637 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Mon, 2 Jun 2014 14:55:14 +0200 Subject: [PATCH] - added aliases for some snapper commands --- client/snapper.cc | 13 ++++++++++--- doc/snapper.xml.in | 5 +++-- package/snapper.changes | 5 +++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/client/snapper.cc b/client/snapper.cc index 8546f3ad..44d744f0 100644 --- a/client/snapper.cc +++ b/client/snapper.cc @@ -66,7 +66,14 @@ struct Cmd works_without_dbus(works_without_dbus), needs_snapper(needs_snapper) {} + Cmd(const string& name, const vector& aliases, cmd_func_t cmd_func, + help_func_t help_func, bool works_without_dbus, bool needs_snapper) + : name(name), aliases(aliases), cmd_func(cmd_func), help_func(help_func), + works_without_dbus(works_without_dbus), needs_snapper(needs_snapper) + {} + const string name; + const vector aliases; const cmd_func_t cmd_func; const help_func_t help_func; const bool works_without_dbus; @@ -1491,10 +1498,10 @@ main(int argc, char** argv) cmds.push_back(Cmd("delete-config", command_delete_config, help_delete_config, true, false)); cmds.push_back(Cmd("get-config", command_get_config, help_get_config, true, false)); cmds.push_back(Cmd("set-config", command_set_config, help_set_config, true, true)); - cmds.push_back(Cmd("list", command_list, help_list, true, true)); + cmds.push_back(Cmd("list", { "ls" }, command_list, help_list, true, true)); cmds.push_back(Cmd("create", command_create, help_create, false, true)); cmds.push_back(Cmd("modify", command_modify, help_modify, false, true)); - cmds.push_back(Cmd("delete", command_delete, help_delete, false, true)); + cmds.push_back(Cmd("delete", { "remove", "rm" }, command_delete, help_delete, false, true)); cmds.push_back(Cmd("mount", command_mount, help_mount, true, true)); cmds.push_back(Cmd("umount", command_umount, help_umount, true, true)); cmds.push_back(Cmd("status", command_status, help_status, false, true)); @@ -1580,7 +1587,7 @@ main(int argc, char** argv) const char* command = getopts.popArg(); list::const_iterator cmd = cmds.begin(); - while (cmd != cmds.end() && cmd->name != command) + while (cmd != cmds.end() && (cmd->name != command && !contains(cmd->aliases, command))) ++cmd; if (cmd == cmds.end()) diff --git a/doc/snapper.xml.in b/doc/snapper.xml.in index 632b6c40..45a09168 100644 --- a/doc/snapper.xml.in +++ b/doc/snapper.xml.in @@ -299,7 +299,7 @@ - + List snapshots. @@ -399,7 +399,8 @@ - + Delete a snapshot or a range of snapshots. diff --git a/package/snapper.changes b/package/snapper.changes index 9fb3683b..eb3d1d76 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jun 02 14:54:29 CEST 2014 - aschnell@suse.de + +- added aliases for some snapper commands + ------------------------------------------------------------------- Tue May 27 11:36:21 CEST 2014 - aschnell@suse.de -- 2.47.3