Merge pull request #1164 from ricardoseriani/fix-key-remove-command

Change key rm command to key remove
This commit is contained in:
Alexander Neumann 2017-08-18 19:49:50 +02:00
commit af9946b098
3 changed files with 5 additions and 5 deletions

View File

@ -12,7 +12,7 @@ import (
) )
var cmdKey = &cobra.Command{ var cmdKey = &cobra.Command{
Use: "key [list|add|rm|passwd] [ID]", Use: "key [list|add|remove|passwd] [ID]",
Short: "manage keys (passwords)", Short: "manage keys (passwords)",
Long: ` Long: `
The "key" command manages keys (passwords) for accessing the repository. The "key" command manages keys (passwords) for accessing the repository.
@ -124,7 +124,7 @@ func changePassword(gopts GlobalOptions, repo *repository.Repository) error {
} }
func runKey(gopts GlobalOptions, args []string) error { func runKey(gopts GlobalOptions, args []string) error {
if len(args) < 1 || (args[0] == "rm" && len(args) != 2) || (args[0] != "rm" && len(args) != 1) { if len(args) < 1 || (args[0] == "remove" && len(args) != 2) || (args[0] != "remove" && len(args) != 1) {
return errors.Fatal("wrong number of arguments") return errors.Fatal("wrong number of arguments")
} }
@ -153,7 +153,7 @@ func runKey(gopts GlobalOptions, args []string) error {
} }
return addKey(gopts, repo) return addKey(gopts, repo)
case "rm": case "remove":
lock, err := lockRepoExclusive(repo) lock, err := lockRepoExclusive(repo)
defer unlockRepo(lock) defer unlockRepo(lock)
if err != nil { if err != nil {

View File

@ -786,7 +786,7 @@ func testRunKeyPasswd(t testing.TB, newPassword string, gopts GlobalOptions) {
func testRunKeyRemove(t testing.TB, gopts GlobalOptions, IDs []string) { func testRunKeyRemove(t testing.TB, gopts GlobalOptions, IDs []string) {
t.Logf("remove %d keys: %q\n", len(IDs), IDs) t.Logf("remove %d keys: %q\n", len(IDs), IDs)
for _, id := range IDs { for _, id := range IDs {
OK(t, runKey(gopts, []string{"rm", id})) OK(t, runKey(gopts, []string{"remove", id}))
} }
} }

View File

@ -10,7 +10,7 @@ restic\-key \- manage keys (passwords)
.SH SYNOPSIS .SH SYNOPSIS
.PP .PP
\fBrestic key [list|add|rm|passwd] [ID] [flags]\fP \fBrestic key [list|add|remove|passwd] [ID] [flags]\fP
.SH DESCRIPTION .SH DESCRIPTION