Skip to content

Commit

Permalink
Merge pull request twpayne#144 from kkirsche/enhancement/secret_toplevel
Browse files Browse the repository at this point in the history
Add support for "secret" command namespace
  • Loading branch information
twpayne committed Jan 17, 2019
2 parents 3ad48a4 + 932a8e9 commit bcc4b9c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/bitwarden.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func init() {
_, err := exec.LookPath(config.Bitwarden.BW)
if err == nil {
// bw is installed
rootCommand.AddCommand(bitwardenCommand)
secretCommand.AddCommand(bitwardenCommand)
persistentFlags := rootCommand.PersistentFlags()
persistentFlags.StringVar(&config.Bitwarden.Session, "bitwarden-session", "", "bitwarden session")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/lastpass.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func init() {
_, err := exec.LookPath(config.LastPass.Lpass)
if err == nil {
// lpass is installed
rootCommand.AddCommand(lastpassCommand)
secretCommand.AddCommand(lastpassCommand)
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/pass.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type PassCommandConfig struct {
var passCache = make(map[string]string)

func init() {
rootCommand.AddCommand(passCommand)
secretCommand.AddCommand(passCommand)
config.Pass.Pass = "pass"
config.addFunc("pass", config.passFunc)
}
Expand Down
13 changes: 13 additions & 0 deletions cmd/secret.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package cmd

import "github.com/spf13/cobra"

var secretCommand = &cobra.Command{
Use: "secret",
Args: cobra.NoArgs,
Short: "Interact with a secret manager",
}

func init() {
rootCommand.AddCommand(secretCommand)
}
2 changes: 1 addition & 1 deletion cmd/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func init() {
_, err := exec.LookPath(config.Vault.Vault)
if err == nil {
// vault is installed
rootCommand.AddCommand(vaultCommand)
secretCommand.AddCommand(vaultCommand)
}
}

Expand Down

0 comments on commit bcc4b9c

Please sign in to comment.