restore flags for some account commands

This commit is contained in:
A.Unger
2021-11-17 16:41:51 +01:00
parent a34f5b6434
commit 592a91053b
6 changed files with 116 additions and 12 deletions
-4
View File
@@ -21,10 +21,6 @@ func AddAccount(cfg *config.Config) *cli.Command {
Aliases: []string{"create", "a"},
Flags: flagset.AddAccountWithConfig(cfg, a),
Before: func(c *cli.Context) error {
if err := ParseConfig(c, cfg); err != nil {
return err
}
// Write value of username to the flags beneath, as preferred name
// and on-premises-sam-account-name is probably confusing for users.
if username := c.String("username"); username != "" {
+3 -3
View File
@@ -5,6 +5,8 @@ import (
"os"
"strconv"
"github.com/owncloud/ocis/accounts/pkg/flagset"
"github.com/asim/go-micro/plugins/client/grpc/v4"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/accounts/pkg/config"
@@ -18,9 +20,7 @@ func InspectAccount(cfg *config.Config) *cli.Command {
Name: "inspect",
Usage: "Show detailed data on an existing account",
ArgsUsage: "id",
Before: func(c *cli.Context) error {
return ParseConfig(c, cfg)
},
Flags: flagset.Root(cfg),
Action: func(c *cli.Context) error {
accServiceID := cfg.GRPC.Namespace + "." + cfg.Server.Name
if c.NArg() != 1 {
+3 -3
View File
@@ -5,6 +5,8 @@ import (
"os"
"strconv"
"github.com/owncloud/ocis/accounts/pkg/flagset"
"github.com/asim/go-micro/plugins/client/grpc/v4"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/accounts/pkg/config"
@@ -18,9 +20,7 @@ func ListAccounts(cfg *config.Config) *cli.Command {
Name: "list",
Usage: "List existing accounts",
Aliases: []string{"ls"},
Before: func(c *cli.Context) error {
return ParseConfig(c, cfg)
},
Flags: flagset.Root(cfg),
Action: func(c *cli.Context) error {
accSvcID := cfg.GRPC.Namespace + "." + cfg.Server.Name
accSvc := accounts.NewAccountsService(accSvcID, grpc.NewClient())
+3
View File
@@ -4,6 +4,8 @@ import (
"fmt"
"os"
"github.com/owncloud/ocis/accounts/pkg/flagset"
"github.com/asim/go-micro/plugins/client/grpc/v4"
"github.com/owncloud/ocis/accounts/pkg/config"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
@@ -17,6 +19,7 @@ func RemoveAccount(cfg *config.Config) *cli.Command {
Usage: "Removes an existing account",
ArgsUsage: "id",
Aliases: []string{"rm"},
Flags: flagset.Root(cfg),
Before: func(c *cli.Context) error {
return ParseConfig(c, cfg)
},
+3 -2
View File
@@ -4,6 +4,8 @@ import (
"errors"
"fmt"
"github.com/owncloud/ocis/accounts/pkg/flagset"
"github.com/asim/go-micro/plugins/client/grpc/v4"
"github.com/owncloud/ocis/accounts/pkg/config"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
@@ -20,10 +22,9 @@ func UpdateAccount(cfg *config.Config) *cli.Command {
Name: "update",
Usage: "Make changes to an existing account",
ArgsUsage: "id",
//Flags: flagset.UpdateAccountWithConfig(cfg, a),
Flags: flagset.UpdateAccountWithConfig(cfg, a),
Before: func(c *cli.Context) error {
if len(c.StringSlice("password_policies")) > 0 {
// StringSliceFlag doesn't support Destination
a.PasswordProfile.PasswordPolicies = c.StringSlice("password_policies")
}