Skip to content

Commit

Permalink
added flags to wave commands
Browse files Browse the repository at this point in the history
  • Loading branch information
hogaco committed Aug 30, 2019
1 parent d15ec9c commit 63d165e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
8 changes: 5 additions & 3 deletions cmd/wave/dcm/dcm_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ func DsmCreate(vcli *client.VirgilHttpClient) *cli.Command {
Aliases: []string{"c"},
ArgsUsage: "app_name",
Usage: "Create new dcm certificate",
Flags: []cli.Flag{&cli.StringFlag{Name: "name", Usage: "dsm certificate name"},
Flags: []cli.Flag{
&cli.StringFlag{Name: "name", Usage: "dsm certificate name"},
&cli.StringFlag{Name: "app_id", Usage: "application id"},
&cli.StringFlag{Name: "encrypt-pub-key", Usage: "encrypt public key"},
&cli.StringFlag{Name: "app-token", Usage: "application token"},
&cli.StringFlag{Name: "verify-pub-key", Usage: "verify public key"}},
Expand All @@ -42,8 +44,8 @@ func DsmCreate(vcli *client.VirgilHttpClient) *cli.Command {
return errors.New("Please, specify app_id (flag --app_id)")
}
appToken := utils.ReadFlagOrDefault(context, "app-token", defaultAppToken)
if appID == "" {
return errors.New("Please, specify app_id (flag --app_id)")
if appToken == "" {
return errors.New("Please, specify app-token (flag --app-token)")
}
dcm, err := DsmCreateFunc(appID, name, encryptPubKey, verifyPubKey, appToken, vcli)
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions cmd/wave/dcm/dcm_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ func DcmList(vcli *client.VirgilHttpClient) *cli.Command {
Name: "list",
Aliases: []string{"l"},
Usage: "List your dcm certificates",
Flags: []cli.Flag{&cli.StringFlag{Name: "app-token", Usage: "application token"}},
Flags: []cli.Flag{
&cli.StringFlag{Name: "app_id", Usage: "application id"},
&cli.StringFlag{Name: "app-token", Usage: "application token"}},

Action: func(context *cli.Context) (err error) {

Expand All @@ -32,8 +34,8 @@ func DcmList(vcli *client.VirgilHttpClient) *cli.Command {
return errors.New("Please, specify app_id (flag --app_id)")
}
appToken := utils.ReadFlagOrDefault(context, "app-token", defaultAppToken)
if appID == "" {
return errors.New("Please, specify app_id (flag --app_id)")
if appToken == "" {
return errors.New("Please, specify app-token (flag --app_token)")
}

certs, err := dcmListFunc(appID, appToken, vcli)
Expand Down
8 changes: 5 additions & 3 deletions cmd/wave/device/device_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ func DeviceList(vcli *client.VirgilHttpClient) *cli.Command {
Name: "list",
Aliases: []string{"l"},
Usage: "List your devices",
Flags: []cli.Flag{&cli.StringFlag{Name: "app-token", Usage: "application token"}},
Flags: []cli.Flag{
&cli.StringFlag{Name: "app_id", Usage: "application id"},
&cli.StringFlag{Name: "app-token", Usage: "application token"}},
Action: func(context *cli.Context) (err error) {

defaultApp, err := utils.LoadDefaultApp()
Expand All @@ -30,8 +32,8 @@ func DeviceList(vcli *client.VirgilHttpClient) *cli.Command {
return errors.New("Please, specify app_id (flag --app_id)")
}
appToken := utils.ReadFlagOrDefault(context, "app-token", defaultAppToken)
if appID == "" {
return errors.New("Please, specify app_id (flag --app_id)")
if appToken == "" {
return errors.New("Please, specify app-token (flag --app-token)")
}

devices, err := deviceListFunc(appID, appToken, vcli)
Expand Down
2 changes: 1 addition & 1 deletion cmd/wave/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Init(vcli *client.VirgilHttpClient) *cli.Command {
return &cli.Command{
Name: "init",
Usage: "Init wave module in application",
Flags: []cli.Flag{&cli.StringFlag{Name: "type", Usage: "application type (e2ee or pure)"}},
Flags: []cli.Flag{&cli.StringFlag{Name: "app_id", Usage: "application id"}},

Action: func(context *cli.Context) (err error) {

Expand Down

0 comments on commit 63d165e

Please sign in to comment.