diff --git a/internal/fleetkey/fleetkey.go b/internal/fleetkey/fleetkey.go index df04dc7..26be30a 100644 --- a/internal/fleetkey/fleetkey.go +++ b/internal/fleetkey/fleetkey.go @@ -63,10 +63,10 @@ func Create(invocation api.Invocation, arguments []string) error { } if created.FleetKey == "" { - return errors.New("the key was not created, try again") + return errors.New("the fleet key was not created, try again") } - fmt.Fprintf(invocation.Out, "Created key %d.\n\n %s\n\nAnyone holding it can send data to the fleet, and you will not see it again.\n", created.Id, api.Printable(created.FleetKey)) + fmt.Fprintf(invocation.Out, "Created fleet key %d.\n\n %s\n\nAnyone holding it can send data to the fleet, and you will not see it again.\n", created.Id, api.Printable(created.FleetKey)) return nil } @@ -130,9 +130,9 @@ func List(invocation api.Invocation, arguments []string) error { if len(fleetKeys) == 0 { if chosenFleetId == 0 { - fmt.Fprintln(invocation.Out, "No keys yet. Create one with key create.") + fmt.Fprintln(invocation.Out, "No fleet keys yet. Create one with key create.") } else { - fmt.Fprintln(invocation.Out, "No keys on that fleet yet.") + fmt.Fprintln(invocation.Out, "No fleet keys on that fleet yet.") } return nil @@ -181,7 +181,7 @@ func Revoke(invocation api.Invocation, arguments []string) error { fleetKeyId, err := strconv.ParseInt(arguments[0], 10, 64) if err != nil || fleetKeyId < 1 { - return errors.New("the key id is the number shown by key list") + return errors.New("the fleet key id is the number shown by key list") } fleetKeys, err := api.FetchFleetKeys(invocation) @@ -201,10 +201,10 @@ func Revoke(invocation api.Invocation, arguments []string) error { } if !found { - return errors.New("no such key") + return errors.New("no such fleet key") } - fmt.Fprintf(invocation.Out, "Revoke key %q? Anything still using it stops reaching the fleet. [y/N] ", label) + fmt.Fprintf(invocation.Out, "Revoke fleet key %q? Anything still using it stops reaching the fleet. [y/N] ", label) answer, _ := bufio.NewReader(invocation.In).ReadString('\n') @@ -234,7 +234,7 @@ func Revoke(invocation api.Invocation, arguments []string) error { return api.ServerError(response) } - fmt.Fprintf(invocation.Out, "Revoked key %q.\n", label) + fmt.Fprintf(invocation.Out, "Revoked fleet key %q.\n", label) return nil } diff --git a/internal/fleetkey/fleetkey_test.go b/internal/fleetkey/fleetkey_test.go index c93a26f..676503c 100644 --- a/internal/fleetkey/fleetkey_test.go +++ b/internal/fleetkey/fleetkey_test.go @@ -131,7 +131,7 @@ func TestFleetKeyCreate(t *testing.T) { t.Errorf("the output %q does not warn that the fleet key cannot be shown again", printed) } - if !strings.Contains(printed, "Created key 1.") { + if !strings.Contains(printed, "Created fleet key 1.") { t.Errorf("the output %q does not name the fleet key it created", printed) } }) @@ -182,13 +182,13 @@ func TestFleetKeyList(t *testing.T) { { name: "no fleet keys", arguments: []string{}, - wantShown: []string{"No keys yet. Create one with key create."}, + wantShown: []string{"No fleet keys yet. Create one with key create."}, fleetKeys: `[]`, }, { name: "a fleet without fleet keys", arguments: []string{"5"}, - wantShown: []string{"No keys on that fleet yet."}, + wantShown: []string{"No fleet keys on that fleet yet."}, wantHidden: []string{"ID FLEET"}, }, { @@ -297,7 +297,7 @@ func TestFleetKeyRevoke(t *testing.T) { arguments: []string{"3"}, answer: "y\n", wantRevoked: "/fleet-keys/3", - wantShown: "Revoked key \"production\".", + wantShown: "Revoked fleet key \"production\".", }, { name: "declined by default", @@ -328,7 +328,7 @@ func TestFleetKeyRevoke(t *testing.T) { name: "a fleet key that is not yours", arguments: []string{"9"}, answer: "y\n", - wantError: "no such key", + wantError: "no such fleet key", }, { name: "no fleet key id", diff --git a/main.go b/main.go index a4ae19e..c0baeeb 100644 --- a/main.go +++ b/main.go @@ -102,14 +102,14 @@ var sections = []dispatch.Section{ }, }, { - Title: "Keys", + Title: "Fleet keys", Commands: []dispatch.Command{ - {Name: "key create", Arguments: "