Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
review cmd package
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Oct 16, 2018
1 parent f007630 commit ab89953
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
3 changes: 1 addition & 2 deletions cmd/ctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const (
)

var (
// TODO issue#173
controlCmd = &cobra.Command{Use: "ctl", Short: "Forma CRUD operations"}
controlCmd = &cobra.Command{Use: "ctl", Short: "Forma Service Control"}
createCmd = &cobra.Command{Use: "create", Short: "Create some kind", RunE: communicate}
readCmd = &cobra.Command{Use: "read", Short: "Read some kind", RunE: communicate}
updateCmd = &cobra.Command{Use: "update", Short: "Update some kind", RunE: communicate}
Expand Down
29 changes: 13 additions & 16 deletions cmd/grpc_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,30 +156,27 @@ func call(cnf config.GRPCConfig, entity interface{}) (interface{}, error) {
middleware.AuthHeader,
kit.Concat(middleware.AuthScheme, " ", string(cnf.Token)))
switch request := entity.(type) {

case *pb.CreateSchemaRequest:
client := pb.NewSchemaClient(conn)
return client.Create(ctx, request)
return pb.NewSchemaClient(conn).Create(ctx, request)
case *pb.CreateTemplateRequest:
client := pb.NewTemplateClient(conn)
return client.Create(ctx, request)
return pb.NewTemplateClient(conn).Create(ctx, request)

case *pb.ReadSchemaRequest:
client := pb.NewSchemaClient(conn)
return client.Read(ctx, request)
return pb.NewSchemaClient(conn).Read(ctx, request)
case *pb.ReadTemplateRequest:
client := pb.NewTemplateClient(conn)
return client.Read(ctx, request)
return pb.NewTemplateClient(conn).Read(ctx, request)

case *pb.UpdateSchemaRequest:
client := pb.NewSchemaClient(conn)
return client.Update(ctx, request)
return pb.NewSchemaClient(conn).Update(ctx, request)
case *pb.UpdateTemplateRequest:
client := pb.NewTemplateClient(conn)
return client.Update(ctx, request)
return pb.NewTemplateClient(conn).Update(ctx, request)

case *pb.DeleteSchemaRequest:
client := pb.NewSchemaClient(conn)
return client.Delete(ctx, request)
return pb.NewSchemaClient(conn).Delete(ctx, request)
case *pb.DeleteTemplateRequest:
client := pb.NewTemplateClient(conn)
return client.Delete(ctx, request)
return pb.NewTemplateClient(conn).Delete(ctx, request)

default:
return nil, errors.Errorf("unknown type %T", request)
}
Expand Down

0 comments on commit ab89953

Please sign in to comment.