Rename "rover" to "status"

This commit is contained in:
Marc Di Luzio 2020-07-04 23:11:12 +01:00
parent f8e594cb39
commit 894359142b
7 changed files with 196 additions and 196 deletions

View file

@ -116,8 +116,8 @@ func TestServer_Rover(t *testing.T) {
err := serv.Request("POST", "register", &rove.RegisterRequest{Name: acc}, &rove.RegisterResponse{})
assert.NoError(t, err, "First register attempt should pass")
resp := &rove.RoverResponse{}
err = serv.Request("POST", "rover", &rove.RoverRequest{
resp := &rove.StatusResponse{}
err = serv.Request("POST", "status", &rove.StatusRequest{
Account: acc,
}, resp)
assert.NoError(t, err, "Rover sould pass should pass")

View file

@ -46,9 +46,9 @@ func (s *Server) Register(ctx context.Context, req *rove.RegisterRequest) (*rove
return &rove.RegisterResponse{}, nil
}
// Rover returns rover information for a gRPC request
func (s *Server) Rover(ctx context.Context, req *rove.RoverRequest) (*rove.RoverResponse, error) {
response := &rove.RoverResponse{}
// Status returns rover information for a gRPC request
func (s *Server) Status(ctx context.Context, req *rove.StatusRequest) (*rove.StatusResponse, error) {
response := &rove.StatusResponse{}
if len(req.Account) == 0 {
return nil, fmt.Errorf("empty account name")
@ -64,7 +64,7 @@ func (s *Server) Rover(ctx context.Context, req *rove.RoverRequest) (*rove.Rover
inv = append(inv, byte(i.Type))
}
response = &rove.RoverResponse{
response = &rove.StatusResponse{
Name: rover.Name,
Position: &rove.Vector{
X: int32(rover.Pos.X),

View file

@ -31,7 +31,7 @@ func printUsage() {
fmt.Fprintln(os.Stderr, "\tregister NAME registers an account and stores it (use with -name)")
fmt.Fprintln(os.Stderr, "\tcommands COMMAND [VAL...] issue commands to rover, accepts multiple, see below")
fmt.Fprintln(os.Stderr, "\tradar gathers radar data for the current rover")
fmt.Fprintln(os.Stderr, "\trover gets data for current rover")
fmt.Fprintln(os.Stderr, "\tstatus gets status info for current rover")
fmt.Fprintln(os.Stderr, "\tconfig [HOST] outputs the local config info, optionally sets host")
fmt.Fprintln(os.Stderr, "\thelp outputs this usage information")
fmt.Fprintln(os.Stderr, "\tversion outputs version info")
@ -277,12 +277,12 @@ func InnerMain(command string, args ...string) error {
}
}
case "rover":
req := rove.RoverRequest{Account: config.Account.Name}
case "status":
req := rove.StatusRequest{Account: config.Account.Name}
if err := verifyID(req.Account); err != nil {
return err
}
response, err := client.Rover(ctx, &req)
response, err := client.Status(ctx, &req)
switch {
case err != nil: