Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions cmd/vaults/keys/keys.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
package keys

import (
"os"

"github.com/provideplatform/provide-cli/cmd/common"
"github.com/spf13/cobra"
)

var KeysCmd = &cobra.Command{
Use: "keys",
Short: "Manage keys",
Long: `Create and manage cryptographic keys.

Supports symmetric and asymmetric key specs with encrypt/decrypt and sign/verify operations.

Docs: https://docs.provide.services/vault/api-reference/keys`,
Long: `Create and manage cryptographic keys. Supports symmetric and asymmetric key specs with encrypt/decrypt and sign/verify operations.`,
Run: func(cmd *cobra.Command, args []string) {
common.CmdExistsOrExit(cmd, args)
generalPrompt(cmd, args, "")

defer func() {
if r := recover(); r != nil {
os.Exit(1)
}
}()
},
}

Expand Down
1 change: 0 additions & 1 deletion cmd/vaults/vaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Docs: https://docs.provide.services/vault`,
func init() {
VaultsCmd.AddCommand(vaultsListCmd)
VaultsCmd.AddCommand(vaultsInitCmd)

VaultsCmd.AddCommand(keys.KeysCmd)
VaultsCmd.Flags().BoolVarP(&optional, "optional", "", false, "List all the optional flags")
VaultsCmd.Flags().BoolVarP(&paginate, "paginate", "", false, "List pagination flags")
Expand Down
6 changes: 5 additions & 1 deletion cmd/vaults/vaults_prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import (
"fmt"

"github.com/provideplatform/provide-cli/cmd/common"
"github.com/provideplatform/provide-cli/cmd/vaults/keys"
"github.com/spf13/cobra"
)

const promptStepInit = "Initialize"
const promptStepList = "List"
const promptKeys = "Keys"

var emptyPromptArgs = []string{promptStepInit, promptStepList}
var emptyPromptArgs = []string{promptStepInit, promptStepList, promptKeys}
var emptyPromptLabel = "What would you like to do"

// General Endpoints
Expand Down Expand Up @@ -45,6 +47,8 @@ func generalPrompt(cmd *cobra.Command, args []string, currentStep string) {
}
page, rpp = common.PromptPagination(paginate, page, rpp)
listVaultsRun(cmd, args)
case promptKeys:
keys.KeysCmd.Run(cmd, args)
case "":
result := common.SelectInput(emptyPromptArgs, emptyPromptLabel)
generalPrompt(cmd, args, result)
Expand Down