basic wiring

This commit is contained in:
A.Unger
2020-10-23 12:23:33 +02:00
parent 50b0e6568b
commit 17b7c82425
3 changed files with 23 additions and 5 deletions

View File

@@ -1,15 +1,32 @@
package command
import (
"context"
"fmt"
"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/client/grpc"
"github.com/owncloud/ocis/accounts/pkg/config"
index "github.com/owncloud/ocis/accounts/pkg/proto/v0"
)
// DeleteIndex rebuilds the entire configured index.
func DeleteIndex(cdf *config.Config) *cli.Command {
return &cli.Command{
Name: "add",
Usage: "Create a new account",
Aliases: []string{"create", "a"},
//Flags: flagset.AddAccountWithConfig(cfg, a),
Name: "rebuildIndex",
Usage: "Rebuilds the service's index",
Aliases: []string{"rebuild", "ri"},
Action: func(ctx *cli.Context) error {
idxSvcID := "com.owncloud.api.accounts"
idxSvc := index.NewIndexService(idxSvcID, grpc.NewClient())
rsp, err := idxSvc.RebuildIndex(context.Background(), &index.RebuildIndexRequest{})
if err != nil {
return err
}
fmt.Printf("deleted: %+v", rsp.Indices)
return nil
},
}
}

View File

@@ -49,6 +49,7 @@ func Execute() error {
InspectAccount(cfg),
RemoveAccount(cfg),
PrintVersion(cfg),
DeleteIndex(cfg),
},
}

View File

@@ -10,6 +10,6 @@ func (s Service) RebuildIndex(ctx context.Context, request *proto.RebuildIndexRe
if err := s.index.Reset(); err != nil {
return err
}
response.Indices = []string{"foo", "bar"}
return nil
}