posh-providers/onepassword
2025-09-22 07:05:37 +02:00
..
checker.go feat: add gokazi 2025-04-07 16:08:19 +02:00
command.go feat(onepassword/onepassword): add download file 2024-07-12 16:19:21 +02:00
config_test.go feat: use json required 2025-09-22 07:05:37 +02:00
config.base.json feat: generate schema 2025-09-19 16:29:28 +02:00
config.go initial commit 2023-01-06 10:44:19 +01:00
config.schema.json feat: generate schema 2025-09-19 16:29:28 +02:00
errors.go initial commit 2023-01-06 10:44:19 +01:00
onepassword.go fix(onepassword): pass account 2024-09-11 15:34:14 +02:00
README.md feat(pulumi): add pulumi azure integration 2024-01-17 09:24:21 +01:00
secret.go feat: add initial providers 2023-01-27 11:15:32 +01:00

POSH 1Password provider

Integrates 1Password into your shell and adds helpers for your commands.

Help

1Password session helper.

Usage:
  op [command]

Available commands:
  get [id]          Retrieve an entry from your account
  signin            Sign into your 1Password account for the session
  register [email]  Add your 1Password account

Usage

Plugin

package plugin

type Plugin struct {
  l        log.Logger
  oo       *onepassword.OnePassword
  cacche   cache.Cache
  commands command.Commands
}

func New(l log.Logger) (plugin.Plugin, error) {
  inst := &Plugin{
    l:        l,
    cache:    cache.MemoryCache{},
    commands: command.Commands{},
  }

  // ...

  inst.op, err := onepassword.New(l, inst.cache));
  if err != nil {
    return nil, errors.Wrap(err, "failed to create onepassword")
  }

  // ...

  inst.commands.MustAdd(onepassword.NewCommand(l, onePassword))

  // ...

  return inst, nil
}

Config

Add this to your '.posh.yml' file:

onePassword:
  account: <ACCOUNT>
  tokenFilename: .posh/config/.op

To add a requirement check for op, add:

require:
  scripts:
    - name: op
      command: |
        [[ $(op account --account <ACCOUNT> get 2>&1) =~ "found no account" ]] && exit 1 || exit 0        
      help: |
        You're 1Password account is not registered yet! Please do so by running:

          $ op account add --address <ACCOUNT>.1password.eu --email <EMAIL>        
  packages:
    - name: op
      version: '~2'
      command: op --version
      help: |
        Please ensure you have the 1Password cli 'op' installed in the required version: %s!

          $ brew update
          $ brew install 1password-cli