Skip to content

Commit

Permalink
Merge pull request #1161 from ripienaar/op_creds
Browse files Browse the repository at this point in the history
Support op for accessing credentials
  • Loading branch information
ripienaar authored Sep 25, 2024
2 parents 7bb1686 + a406087 commit 9aeb804
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
7 changes: 5 additions & 2 deletions cli/context_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ import (
"bytes"
"encoding/json"
"fmt"
iu "github.com/nats-io/natscli/internal/util"
"os"
"os/exec"
"sort"
"strings"
"text/template"

iu "github.com/nats-io/natscli/internal/util"

"github.com/AlecAivazis/survey/v2"
"github.com/choria-io/fisk"
"github.com/fatih/color"
Expand Down Expand Up @@ -450,7 +451,9 @@ func (c *ctxCommand) showCommand(_ *fisk.ParseContext) error {
if file == "" {
return ""
}

if strings.HasPrefix(file, "op://") {
return color.CyanString("1Password")
}
ok, err := fileAccessible(file)
if !ok || err != nil {
c.validateErrors++
Expand Down
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ require (
github.com/guptarohit/asciigraph v0.7.2
github.com/jedib0t/go-pretty/v6 v6.5.9
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/klauspost/compress v1.17.9
github.com/klauspost/compress v1.17.10
github.com/mattn/go-isatty v0.0.20
github.com/nats-io/jsm.go v0.1.1-0.20240919203217-782ac92b60d7
github.com/nats-io/jwt/v2 v2.6.0
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20240924173324-4954cc0786ee
github.com/nats-io/jsm.go v0.1.1-0.20240925194717-21ca5720ba1e
github.com/nats-io/jwt/v2 v2.7.0
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20240925161109-4c21aa3ac686
github.com/nats-io/nats.go v1.37.0
github.com/nats-io/nkeys v0.4.7
github.com/nats-io/nuid v1.0.1
github.com/prometheus/client_golang v1.20.4
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/synadia-io/jwt-auth-builder.go v0.0.0-20240628155003-21e8d1e9d490
github.com/synadia-io/jwt-auth-builder.go v0.0.0-20240829124321-43722a8ce3ce
github.com/tylertreat/hdrhistogram-writer v0.0.0-20210816161836-2e440612a39f
golang.org/x/crypto v0.27.0
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
Expand Down Expand Up @@ -63,7 +63,6 @@ require (
github.com/rivo/uniseg v0.4.7 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
go.uber.org/automaxprocs v1.5.3 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
Expand Down
24 changes: 10 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8S
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0=
github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand Down Expand Up @@ -106,14 +106,12 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/nats-io/jsm.go v0.1.1-0.20240919203217-782ac92b60d7 h1:vyVnCA2swSJpd8/tL5kqYh8rMu6v1i4nUDom7VWLD78=
github.com/nats-io/jsm.go v0.1.1-0.20240919203217-782ac92b60d7/go.mod h1:X3kQ9kNPpxvGCS7zUglCUJsJY+2wg5Kf2GqxGbHLVkA=
github.com/nats-io/jwt/v2 v2.6.0 h1:yXoBTdEotZw3NujMT+Nnu1UPNlFWdKQ3d0JJF/+pJag=
github.com/nats-io/jwt/v2 v2.6.0/go.mod h1:ZdWS1nZa6WMZfFwwgpEaqBV8EPGVgOTDHN/wTbz0Y5A=
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20240919192050-816061f4f441 h1:zRz6lR7kpJGsScHQldbr0LFSzC5BWiX1r08oDgp42Tw=
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20240919192050-816061f4f441/go.mod h1:7ME9V++zVk2hoBe5VOvq/WMQuOuNeyhG63bOwWWokZY=
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20240924173324-4954cc0786ee h1:i2k5VdmuIi1S2KUDzB6yecKMHp1JoeP3h/xUpoPPCkk=
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20240924173324-4954cc0786ee/go.mod h1:7ME9V++zVk2hoBe5VOvq/WMQuOuNeyhG63bOwWWokZY=
github.com/nats-io/jsm.go v0.1.1-0.20240925194717-21ca5720ba1e h1:gqWFexXLEEyvJVFkzMoXySEch3jb36SUl4L2JeyeOYQ=
github.com/nats-io/jsm.go v0.1.1-0.20240925194717-21ca5720ba1e/go.mod h1:ATEgF+8pfA1tQ79KBHuspyUsXQrHYDkh5WRT+Ie0XiU=
github.com/nats-io/jwt/v2 v2.7.0 h1:J+ZnaaMGQi3xSB8iOhVM5ipiWCDrQvgEoitTwWFyOYw=
github.com/nats-io/jwt/v2 v2.7.0/go.mod h1:ZdWS1nZa6WMZfFwwgpEaqBV8EPGVgOTDHN/wTbz0Y5A=
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20240925161109-4c21aa3ac686 h1:Kav0QoU/92ToG/V4O1rnjGtC9Y7UiC0otXl3FmGWMiI=
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20240925161109-4c21aa3ac686/go.mod h1:7ME9V++zVk2hoBe5VOvq/WMQuOuNeyhG63bOwWWokZY=
github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE=
github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
Expand Down Expand Up @@ -155,13 +153,11 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/synadia-io/jwt-auth-builder.go v0.0.0-20240628155003-21e8d1e9d490 h1:kQ0l2H+bm1rbCanV4w2wCEOy1ofgpU2kI+Pykg+j9BU=
github.com/synadia-io/jwt-auth-builder.go v0.0.0-20240628155003-21e8d1e9d490/go.mod h1:z+ZENSUrwJFMZstPcEfPAXXVKRibe0iqx0ACG5ikYBg=
github.com/synadia-io/jwt-auth-builder.go v0.0.0-20240829124321-43722a8ce3ce h1:/BAyu+r73DXnBe/+dHuwV6HAZ7cg/ifsjqQaBw0gF6Q=
github.com/synadia-io/jwt-auth-builder.go v0.0.0-20240829124321-43722a8ce3ce/go.mod h1:z+ZENSUrwJFMZstPcEfPAXXVKRibe0iqx0ACG5ikYBg=
github.com/tylertreat/hdrhistogram-writer v0.0.0-20210816161836-2e440612a39f h1:SGznmvCovewbaSgBsHgdThtWsLj5aCLX/3ZXMLd1UD0=
github.com/tylertreat/hdrhistogram-writer v0.0.0-20210816161836-2e440612a39f/go.mod h1:IY84XkhrEJTdHYLNy/zObs8mXuUAp9I65VyarbPSCCY=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
Expand Down

0 comments on commit 9aeb804

Please sign in to comment.