Skip to content

Commit

Permalink
Remove --bitwarden-session flag
Browse files Browse the repository at this point in the history
Users will likely always set the BM_SESSION environment variable anyway.
  • Loading branch information
twpayne committed Jan 17, 2019
1 parent 333066e commit 24f7131
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -330,8 +330,7 @@ Unlock your Bitwarden vault:

$ bw unlock

Set the `BW_SESSION` environment variable, as instructed. You can also pass the
session directly to `chezmoi` using the `--bitwarden-session` flag.
Set the `BW_SESSION` environment variable, as instructed.

The structured data from `bw get` is available as the `bitwarden` template
function in your config files, for example:
Expand Down
11 changes: 1 addition & 10 deletions cmd/secret_bitwarden.go
Expand Up @@ -18,8 +18,7 @@ var bitwardenCommand = &cobra.Command{
}

type bitwardenCommandConfig struct {
Bw string
Session string
Bw string
}

var bitwardenCache = make(map[string]interface{})
Expand All @@ -29,14 +28,9 @@ func init() {
config.addTemplateFunc("bitwarden", config.bitwardenFunc)

secretCommand.AddCommand(bitwardenCommand)
persistentFlags := rootCommand.PersistentFlags()
persistentFlags.StringVar(&config.Bitwarden.Session, "bitwarden-session", "", "bitwarden session")
}

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...))
}

Expand All @@ -46,9 +40,6 @@ func (c *Config) bitwardenFunc(args ...string) interface{} {
return data
}
name := c.Bitwarden.Bw
if c.Bitwarden.Session != "" {
args = append([]string{"--session", c.Bitwarden.Session}, args...)
}
args = append([]string{"get"}, args...)
if c.Verbose {
fmt.Printf("%s %s\n", name, strings.Join(args, " "))
Expand Down

0 comments on commit 24f7131

Please sign in to comment.