mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-01 18:40:14 -06:00
basic wiring
This commit is contained in:
@@ -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
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ func Execute() error {
|
||||
InspectAccount(cfg),
|
||||
RemoveAccount(cfg),
|
||||
PrintVersion(cfg),
|
||||
DeleteIndex(cfg),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user