Skip to content

Commit

Permalink
Rename field for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Jan 17, 2019
1 parent abf762f commit 718ae00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (c *Config) runDoctorCommand(fs vfs.FS, args []string) error {
name string
}{
{description: "1Password", name: config.OnePassword.Op},
{description: "Bitwarden", name: config.Bitwarden.BW},
{description: "Bitwarden", name: config.Bitwarden.Bw},
{description: "Editor", name: config.getEditor()},
{description: "LastPass", name: config.LastPass.Lpass},
{description: "Pass", name: config.Pass.Pass},
Expand Down
10 changes: 5 additions & 5 deletions cmd/secret_bitwarden.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ var bitwardenCommand = &cobra.Command{
}

type bitwardenCommandConfig struct {
BW string
Bw string
Session string
}

var bitwardenCache = make(map[string]interface{})

func init() {
config.Bitwarden.BW = "bw"
config.Bitwarden.Bw = "bw"
config.addFunc("bitwarden", config.bitwardenFunc)

_, err := exec.LookPath(config.Bitwarden.BW)
_, err := exec.LookPath(config.Bitwarden.Bw)
if err == nil {
// bw is installed
secretCommand.AddCommand(bitwardenCommand)
Expand All @@ -41,15 +41,15 @@ func (c *Config) runBitwardenCommand(fs vfs.FS, args []string) error {
if c.Bitwarden.Session != "" {
args = append([]string{"--session", c.Bitwarden.Session}, args...)
}
return c.exec(append([]string{c.Bitwarden.BW}, args...))
return c.exec(append([]string{c.Bitwarden.Bw}, args...))
}

func (c *Config) bitwardenFunc(args ...string) interface{} {
key := strings.Join(args, "\x00")
if data, ok := bitwardenCache[key]; ok {
return data
}
name := c.Bitwarden.BW
name := c.Bitwarden.Bw
if c.Bitwarden.Session != "" {
args = append([]string{"--session", c.Bitwarden.Session}, args...)
}
Expand Down

0 comments on commit 718ae00

Please sign in to comment.