diff --git a/cmd/step/main.go b/cmd/step/main.go index 3b68d0d4..79df1511 100644 --- a/cmd/step/main.go +++ b/cmd/step/main.go @@ -12,18 +12,19 @@ import ( "time" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/command/version" - "github.com/smallstep/cli/config" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/usage" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" + "go.step.sm/cli-utils/step" // Enabled commands _ "github.com/smallstep/cli/command/base64" _ "github.com/smallstep/cli/command/beta" _ "github.com/smallstep/cli/command/ca" _ "github.com/smallstep/cli/command/certificate" + _ "github.com/smallstep/cli/command/context" _ "github.com/smallstep/cli/command/crypto" _ "github.com/smallstep/cli/command/fileserver" _ "github.com/smallstep/cli/command/oauth" @@ -48,8 +49,8 @@ var Version = "N/A" var BuildTime = "N/A" func init() { - config.Set("Smallstep CLI", Version, BuildTime) - ca.UserAgent = config.Version() + step.Set("Smallstep CLI", Version, BuildTime) + ca.UserAgent = step.Version() rand.Seed(time.Now().UnixNano()) } @@ -71,7 +72,7 @@ func main() { app.Name = "step" app.HelpName = "step" app.Usage = "plumbing for distributed systems" - app.Version = config.Version() + app.Version = step.Version() app.Commands = command.Retrieve() app.Flags = append(app.Flags, cli.HelpFlag) app.EnableBashCompletion = true @@ -120,8 +121,8 @@ func main() { func panicHandler() { if r := recover(); r != nil { if os.Getenv("STEPDEBUG") == "1" { - fmt.Fprintf(os.Stderr, "%s\n", config.Version()) - fmt.Fprintf(os.Stderr, "Release Date: %s\n\n", config.ReleaseDate()) + fmt.Fprintf(os.Stderr, "%s\n", step.Version()) + fmt.Fprintf(os.Stderr, "Release Date: %s\n\n", step.ReleaseDate()) panic(r) } else { fmt.Fprintln(os.Stderr, "Something unexpected happened.") diff --git a/command/base64/base64.go b/command/base64/base64.go index 461875c5..5bc8ddb2 100644 --- a/command/base64/base64.go +++ b/command/base64/base64.go @@ -8,9 +8,9 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func init() { @@ -28,7 +28,7 @@ Encode to base64 using the standard encoding: ''' $ echo -n This is the string to encode | step base64 VGhpcyBpcyB0aGUgc3RyaW5nIHRvIGVuY29kZQ== -$ step base64 This is the string to encode +$ step base64 This is the string to encode VGhpcyBpcyB0aGUgc3RyaW5nIHRvIGVuY29kZQ== ''' diff --git a/command/beta/beta.go b/command/beta/beta.go index 62ba211d..dc2c827a 100644 --- a/command/beta/beta.go +++ b/command/beta/beta.go @@ -1,9 +1,9 @@ package beta import ( - "github.com/smallstep/cli/command" "github.com/smallstep/cli/command/ca" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) // init creates and registers the ca command diff --git a/command/ca/bootstrap.go b/command/ca/bootstrap.go index eac737fa..41fde638 100644 --- a/command/ca/bootstrap.go +++ b/command/ca/bootstrap.go @@ -9,8 +9,6 @@ import ( "github.com/pkg/errors" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/command" - "github.com/smallstep/cli/config" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" @@ -19,6 +17,8 @@ import ( "github.com/smallstep/cli/utils/cautils" "github.com/smallstep/truststore" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" + "go.step.sm/cli-utils/step" ) func bootstrapCommand() cli.Command { @@ -99,7 +99,7 @@ func bootstrapAction(ctx *cli.Context) error { fingerprint := strings.TrimSpace(ctx.String("fingerprint")) team := ctx.String("team") rootFile := pki.GetRootCAPath() - configFile := filepath.Join(config.StepPath(), "config", "defaults.json") + configFile := filepath.Join(step.Path(), "config", "defaults.json") redirectURL := ctx.String("redirect-url") switch { diff --git a/command/ca/ca.go b/command/ca/ca.go index a9eb4756..1dde46b2 100644 --- a/command/ca/ca.go +++ b/command/ca/ca.go @@ -5,11 +5,11 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/command/ca/admin" "github.com/smallstep/cli/command/ca/provisioner" "github.com/smallstep/cli/command/ca/provisionerbeta" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) // init creates and registers the ca command diff --git a/command/ca/certificate.go b/command/ca/certificate.go index 640f1d9f..2c579a62 100644 --- a/command/ca/certificate.go +++ b/command/ca/certificate.go @@ -4,7 +4,6 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" @@ -12,6 +11,7 @@ import ( "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func certificateCommand() cli.Command { diff --git a/command/ca/federation.go b/command/ca/federation.go index 6cb761b4..10ba18ff 100644 --- a/command/ca/federation.go +++ b/command/ca/federation.go @@ -9,13 +9,13 @@ import ( "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) type flowType int diff --git a/command/ca/init.go b/command/ca/init.go index 1f6730bb..19b31fcc 100644 --- a/command/ca/init.go +++ b/command/ca/init.go @@ -14,7 +14,6 @@ import ( "github.com/smallstep/certificates/cas/apiv1" "github.com/smallstep/certificates/kms" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/ui" @@ -23,6 +22,8 @@ import ( // Enable azurekms _ "github.com/smallstep/certificates/kms/azurekms" + + "go.step.sm/cli-utils/command" ) func initCommand() cli.Command { diff --git a/command/ca/renew.go b/command/ca/renew.go index 799a56ea..2b930b34 100644 --- a/command/ca/renew.go +++ b/command/ca/renew.go @@ -22,7 +22,6 @@ import ( "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/crypto/x509util" "github.com/smallstep/cli/errs" @@ -32,6 +31,7 @@ import ( "github.com/smallstep/cli/utils/cautils" "github.com/smallstep/cli/utils/sysutils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func renewCertificateCommand() cli.Command { diff --git a/command/ca/revoke.go b/command/ca/revoke.go index 21a78f2b..698ff7b5 100644 --- a/command/ca/revoke.go +++ b/command/ca/revoke.go @@ -16,7 +16,6 @@ import ( "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/crypto/x509util" "github.com/smallstep/cli/errs" @@ -25,6 +24,7 @@ import ( "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ocsp" ) diff --git a/command/ca/root.go b/command/ca/root.go index d3a1ede6..c248f1a4 100644 --- a/command/ca/root.go +++ b/command/ca/root.go @@ -10,12 +10,12 @@ import ( "github.com/pkg/errors" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func rootComand() cli.Command { diff --git a/command/ca/sign.go b/command/ca/sign.go index b6507935..67188c6d 100644 --- a/command/ca/sign.go +++ b/command/ca/sign.go @@ -6,7 +6,6 @@ import ( "github.com/pkg/errors" "github.com/smallstep/certificates/api" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" @@ -14,6 +13,7 @@ import ( "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func signCertificateCommand() cli.Command { diff --git a/command/ca/token.go b/command/ca/token.go index 66a2e656..0f01336d 100644 --- a/command/ca/token.go +++ b/command/ca/token.go @@ -6,12 +6,12 @@ import ( "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func tokenCommand() cli.Command { diff --git a/command/certificate/bundle.go b/command/certificate/bundle.go index 54b3e633..0b28fd87 100644 --- a/command/certificate/bundle.go +++ b/command/certificate/bundle.go @@ -5,12 +5,12 @@ import ( "io/ioutil" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func bundleCommand() cli.Command { diff --git a/command/certificate/certificate.go b/command/certificate/certificate.go index 5b98ba7f..639bbeea 100644 --- a/command/certificate/certificate.go +++ b/command/certificate/certificate.go @@ -1,8 +1,8 @@ package certificate import ( - "github.com/smallstep/cli/command" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) // Command returns the cli.Command for jwt and related subcommands. diff --git a/command/certificate/create.go b/command/certificate/create.go index 46774ce8..e68b7162 100644 --- a/command/certificate/create.go +++ b/command/certificate/create.go @@ -7,7 +7,6 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/keys" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" @@ -15,6 +14,7 @@ import ( "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "go.step.sm/crypto/x509util" ) diff --git a/command/certificate/format.go b/command/certificate/format.go index fc3e878f..c208307a 100644 --- a/command/certificate/format.go +++ b/command/certificate/format.go @@ -7,12 +7,12 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func formatCommand() cli.Command { diff --git a/command/certificate/install.go b/command/certificate/install.go index a8be1b5e..6fde190b 100644 --- a/command/certificate/install.go +++ b/command/certificate/install.go @@ -6,11 +6,11 @@ import ( "github.com/pkg/errors" "github.com/smallstep/certinfo" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/truststore" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func installCommand() cli.Command { diff --git a/command/certificate/key.go b/command/certificate/key.go index 9a2c7787..be3b870e 100644 --- a/command/certificate/key.go +++ b/command/certificate/key.go @@ -7,11 +7,11 @@ import ( "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func keyCommand() cli.Command { @@ -20,11 +20,11 @@ func keyCommand() cli.Command { Action: command.ActionFunc(keyAction), Usage: "print public key embedded in a certificate", UsageText: "**step certificate key** [**--out**=]", - Description: `**step certificate key** prints the public key embedded in a certificate or + Description: `**step certificate key** prints the public key embedded in a certificate or a certificate signing request. If is a certificate bundle, only the first block will be taken into account. -The command will print a public or a decrypted private key if +The command will print a public or a decrypted private key if contains only a key. ## POSITIONAL ARGUMENTS diff --git a/command/certificate/p12.go b/command/certificate/p12.go index 76182288..94fa07c9 100644 --- a/command/certificate/p12.go +++ b/command/certificate/p12.go @@ -5,13 +5,13 @@ import ( "crypto/x509" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "software.sslmate.com/src/go-pkcs12" ) diff --git a/command/command.go b/command/command.go index 1edec8fc..c60be705 100644 --- a/command/command.go +++ b/command/command.go @@ -10,9 +10,9 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/config" "github.com/smallstep/cli/usage" "github.com/urfave/cli" + "go.step.sm/cli-utils/step" ) // IgnoreEnvVar is a value added to a flag EnvVar to avoid the use of @@ -61,7 +61,7 @@ func IsForce() bool { func getConfigVars(ctx *cli.Context) error { configFile := ctx.GlobalString("config") if configFile == "" { - configFile = filepath.Join(config.StepPath(), "config", "defaults.json") + configFile = filepath.Join(step.Path(), "config", "defaults.json") } b, err := ioutil.ReadFile(configFile) diff --git a/command/context/context.go b/command/context/context.go new file mode 100644 index 00000000..e6e43c1a --- /dev/null +++ b/command/context/context.go @@ -0,0 +1,56 @@ +package context + +import ( + "github.com/urfave/cli" + "go.step.sm/cli-utils/command" +) + +// init creates and registers the ca command +func init() { + cmd := cli.Command{ + Name: "context", + Usage: "manage certificate authority contexts", + UsageText: "**step context** [arguments] [global-flags] [subcommand-flags]", + Description: `**step context** command group provides facilities to manage certificate +authority contexts. + +## EXAMPLES + +''' +$ cat $(step path --base)/contexts.json +{ + "alpha-one": { + "authority": "alpha-one.ca.smallstep.com", + "profile": "alpha-one" + }, + "alpha-two": { + "authority": "alpha-two.ca.smallstep.com", + "profile": "alpha-two" + }, + "beta": { + "authority": "beta.ca.smallstep.com", + "profile": "beta" + } +} +''' + +Set the default certificate authority context: +''' +$ step context set alpha-one +''' + +List the available certificate authority contexts: +''' +$ step context list +alpha-one +alpha-two +beta +'''`, + Subcommands: cli.Commands{ + setCommand(), + listCommand(), + }, + } + + command.Register(cmd) +} diff --git a/command/context/list.go b/command/context/list.go new file mode 100644 index 00000000..98f6106e --- /dev/null +++ b/command/context/list.go @@ -0,0 +1,45 @@ +package context + +import ( + "github.com/smallstep/cli/ui" + "github.com/urfave/cli" + "go.step.sm/cli-utils/command" + "go.step.sm/cli-utils/step" +) + +func listCommand() cli.Command { + return cli.Command{ + Name: "list", + Usage: "list available certificate authority contexts", + UsageText: "**step context list**", + Description: `**step context list** command lists available certificate authority contexts. + +## EXAMPLES + +List all certificate authority contexts: +''' +$ step context list +alpha-one.ca.smallstep.com +alpha-two.ca.smallstep.com +beta.ca.smallstep.com +'''`, + Action: command.ActionFunc(listAction), + } +} + +func listAction(ctx *cli.Context) error { + cm := step.GetContextMap() + + def := step.GetCurrentContext() + if def != nil { + ui.Printf("▶ %s\n", def.Name) + } + + for k := range cm { + if k == def.Name { + continue + } + ui.Println(k) + } + return nil +} diff --git a/command/context/set.go b/command/context/set.go new file mode 100644 index 00000000..5078dfae --- /dev/null +++ b/command/context/set.go @@ -0,0 +1,57 @@ +package context + +import ( + "encoding/json" + + "github.com/pkg/errors" + "github.com/smallstep/cli/errs" + "github.com/urfave/cli" + "go.step.sm/cli-utils/command" + "go.step.sm/cli-utils/fileutil" + "go.step.sm/cli-utils/step" +) + +func setCommand() cli.Command { + return cli.Command{ + Name: "set", + Usage: "set the default certificate authority context", + UsageText: "**step context set**", + Description: `**step context set** command sets the default certificate authority context. + +## EXAMPLES + +Set the default certificate authority context: +''' +$ step context set alpha-one +'''`, + Action: command.ActionFunc(setAction), + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "force", + Usage: `Create the JWK key pair for the provisioner.`, + Hidden: true, + }, + }, + } +} + +func setAction(ctx *cli.Context) error { + ctxStr := ctx.Args().Get(0) + if _, ok := step.GetContext(ctxStr); !ok { + return errors.Errorf("context '%s' not found", ctxStr) + } + + type currentCtxType struct { + Context string `json:"context"` + } + def := currentCtxType{Context: ctxStr} + b, err := json.Marshal(def) + if err != nil { + return err + } + ctx.Set("force", "true") + if err = fileutil.WriteFile(step.CurrentContextFile(), b, 0644); err != nil { + return errs.FileError(err, step.CurrentContextFile()) + } + return nil +} diff --git a/command/crypto/change-pass.go b/command/crypto/change-pass.go index dd112073..54007a6b 100644 --- a/command/crypto/change-pass.go +++ b/command/crypto/change-pass.go @@ -9,13 +9,13 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/jose" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" + "go.step.sm/cli-utils/command" ) func changePassCommand() cli.Command { diff --git a/command/crypto/crypto.go b/command/crypto/crypto.go index 459e488b..f4123fcb 100644 --- a/command/crypto/crypto.go +++ b/command/crypto/crypto.go @@ -1,7 +1,6 @@ package crypto import ( - "github.com/smallstep/cli/command" "github.com/smallstep/cli/command/crypto/hash" "github.com/smallstep/cli/command/crypto/jose" "github.com/smallstep/cli/command/crypto/jwe" @@ -14,6 +13,7 @@ import ( "github.com/smallstep/cli/command/crypto/otp" "github.com/smallstep/cli/command/crypto/winpe" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func init() { diff --git a/command/crypto/jwk/create.go b/command/crypto/jwk/create.go index 3f62150a..bae2e855 100644 --- a/command/crypto/jwk/create.go +++ b/command/crypto/jwk/create.go @@ -8,7 +8,6 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/randutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" @@ -16,6 +15,7 @@ import ( "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) const ( diff --git a/command/crypto/key/fingerprint.go b/command/crypto/key/fingerprint.go index 126fb901..b034877c 100644 --- a/command/crypto/key/fingerprint.go +++ b/command/crypto/key/fingerprint.go @@ -13,11 +13,11 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/crypto/key/format.go b/command/crypto/key/format.go index 016d24b7..8732b982 100644 --- a/command/crypto/key/format.go +++ b/command/crypto/key/format.go @@ -11,7 +11,6 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" @@ -19,6 +18,7 @@ import ( "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/crypto/key/inspect.go b/command/crypto/key/inspect.go index 87c43b75..e4fcfd96 100644 --- a/command/crypto/key/inspect.go +++ b/command/crypto/key/inspect.go @@ -9,11 +9,11 @@ import ( "math/big" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func inspectCommand() cli.Command { diff --git a/command/crypto/key/public.go b/command/crypto/key/public.go index 6f2603e3..b5ac30fc 100644 --- a/command/crypto/key/public.go +++ b/command/crypto/key/public.go @@ -4,13 +4,13 @@ import ( "encoding/pem" "os" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "go.step.sm/crypto/keyutil" ) diff --git a/command/crypto/keypair.go b/command/crypto/keypair.go index 073bf328..b171a63c 100644 --- a/command/crypto/keypair.go +++ b/command/crypto/keypair.go @@ -2,7 +2,6 @@ package crypto import ( "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/keys" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" @@ -11,6 +10,7 @@ import ( "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func createKeyPairCommand() cli.Command { diff --git a/command/crypto/nacl/box.go b/command/crypto/nacl/box.go index feed3c7c..3d1a647a 100644 --- a/command/crypto/nacl/box.go +++ b/command/crypto/nacl/box.go @@ -7,12 +7,12 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/nacl/box" ) diff --git a/command/crypto/nacl/sign.go b/command/crypto/nacl/sign.go index 6ace0273..0209825e 100644 --- a/command/crypto/nacl/sign.go +++ b/command/crypto/nacl/sign.go @@ -7,12 +7,12 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/nacl/sign" ) diff --git a/command/crypto/otp/generate.go b/command/crypto/otp/generate.go index 637044b3..95136b7c 100644 --- a/command/crypto/otp/generate.go +++ b/command/crypto/otp/generate.go @@ -8,11 +8,11 @@ import ( "github.com/pquerna/otp" "github.com/pquerna/otp/totp" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func generateCommand() cli.Command { diff --git a/command/fileserver/fileserver.go b/command/fileserver/fileserver.go index 0d15d3c9..32105ceb 100644 --- a/command/fileserver/fileserver.go +++ b/command/fileserver/fileserver.go @@ -13,8 +13,8 @@ import ( "github.com/smallstep/cli/errs" "github.com/smallstep/cli/utils" - "github.com/smallstep/cli/command" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func init() { diff --git a/command/oauth/cmd.go b/command/oauth/cmd.go index 2a92bb4f..b4e0d216 100644 --- a/command/oauth/cmd.go +++ b/command/oauth/cmd.go @@ -19,7 +19,6 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/randutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/exec" @@ -27,6 +26,7 @@ import ( "github.com/smallstep/cli/jose" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) // These are the OAuth2.0 client IDs from the Step CLI. This application is diff --git a/command/path/path.go b/command/path/path.go index 06f50e27..5a9b25d9 100644 --- a/command/path/path.go +++ b/command/path/path.go @@ -3,21 +3,101 @@ package path import ( "fmt" - "github.com/smallstep/cli/command" - "github.com/smallstep/cli/config" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" + "go.step.sm/cli-utils/step" ) func init() { cmd := cli.Command{ Name: "path", Usage: "print the configured step path and exit", - UsageText: "step path", + UsageText: "**step path** [**--base**] [**--profile**]", Description: `**step path** command prints the configured step path and exits. -The default step path of $HOME/.step can be overridden with the **STEPPATH** environment variable.`, +When using contexts to manage 'step-ca' environments, this command will return +the current authority path. If no current context is configured this command the +default step path of $HOME/.step, which can be overridden with the **STEPPATH** +environment variable. + +## EXAMPLES + +Get the path with no current context configured: +''' +$ step path +/Users/max/.step +''' + +Get the path with no current context and environment variable STEPPATH overriding the default: +''' +$ export STEPPATH=/tmp/step +$ step path +/tmp/step +''' + +Get the path with a current context (configured at $STEPPATH/current-context.json): +''' +$ cat $(step path --base)/current-context.json +{"context": "machine.step-internal.net"} + +$ step path +/Users/max/.step/authorities/machine.step-internal.net +''' + +Get the base path: +''' +$ step path --base +/Users/max/.step +''' + +Get the base path with environment variable STEPPATH overriding the default: +''' +$ export STEPPATH=/tmp/step +$ step path --base +/tmp/step +''' + +Get the path of the current profile: +''' +$ cat $(step path --base)/current-context.json +{"context": "ca.acme.net"} + +$ cat $(step path --base)/contexts.json +{ + "ca.beta.net": { + "profile": "beta-corp", + "authority": "machine.beta.net" + }, + "ca.acme.net": { + "profile": "example-corp", + "authority": "machine.acme.net" + } + +} +$ step path --profile +/Users/max/.step/profiles/beta-corp +''' +`, + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "base", + Usage: "Return the base of the step path", + }, + cli.BoolFlag{ + Name: "profile", + Usage: "Return the base path of the currently configured default profile", + }, + }, Action: cli.ActionFunc(func(ctx *cli.Context) error { - fmt.Println(config.StepPath()) + if ctx.Bool("base") { + fmt.Println(step.BasePath()) + return nil + } + if ctx.Bool("profile") { + fmt.Println(step.ProfilePath()) + return nil + } + fmt.Println(step.Path()) return nil }), } diff --git a/command/ssh/certificate.go b/command/ssh/certificate.go index 31dce317..d0e6c9db 100644 --- a/command/ssh/certificate.go +++ b/command/ssh/certificate.go @@ -15,7 +15,6 @@ import ( "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/ca/identity" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/keys" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/crypto/sshutil" @@ -25,6 +24,7 @@ import ( "github.com/smallstep/cli/utils" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/blake2b" "golang.org/x/crypto/ssh" ) diff --git a/command/ssh/checkHost.go b/command/ssh/checkHost.go index 980170b9..0518eb0e 100644 --- a/command/ssh/checkHost.go +++ b/command/ssh/checkHost.go @@ -9,13 +9,13 @@ import ( "github.com/pkg/errors" "github.com/smallstep/certificates/ca" caErrs "github.com/smallstep/certificates/errs" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/jose" "github.com/smallstep/cli/token" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func checkHostCommand() cli.Command { diff --git a/command/ssh/config.go b/command/ssh/config.go index 5661ff29..fffff4d4 100644 --- a/command/ssh/config.go +++ b/command/ssh/config.go @@ -11,14 +11,14 @@ import ( "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/command" - "github.com/smallstep/cli/config" "github.com/smallstep/cli/crypto/sshutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" + "go.step.sm/cli-utils/step" "golang.org/x/crypto/ssh" ) @@ -177,7 +177,7 @@ func configAction(ctx *cli.Context) (recoverErr error) { data := map[string]string{ "GOOS": runtime.GOOS, - "StepPath": config.StepPath(), + "StepPath": step.Path(), } if len(sets) > 0 { for _, s := range sets { @@ -256,7 +256,7 @@ func configAction(ctx *cli.Context) (recoverErr error) { if ctx.Bool("dry-run") { for _, t := range templates { - ui.Printf("{{ \"%s\" | bold }}\n", config.StepAbs(t.Path)) + ui.Printf("{{ \"%s\" | bold }}\n", step.Abs(t.Path)) fmt.Println(string(t.Content)) } return nil @@ -266,7 +266,7 @@ func configAction(ctx *cli.Context) (recoverErr error) { if err := t.Write(); err != nil { return err } - ui.Printf(`{{ "%s" | green }} {{ "%s" | bold }}`+"\n", ui.IconGood, config.StepAbs(t.Path)) + ui.Printf(`{{ "%s" | green }} {{ "%s" | bold }}`+"\n", ui.IconGood, step.Abs(t.Path)) } return nil diff --git a/command/ssh/fingerprint.go b/command/ssh/fingerprint.go index 36694bc6..1abc0e29 100644 --- a/command/ssh/fingerprint.go +++ b/command/ssh/fingerprint.go @@ -3,11 +3,11 @@ package ssh import ( "fmt" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/sshutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func fingerPrintCommand() cli.Command { diff --git a/command/ssh/hosts.go b/command/ssh/hosts.go index e686ceb5..ef280c63 100644 --- a/command/ssh/hosts.go +++ b/command/ssh/hosts.go @@ -6,11 +6,11 @@ import ( "text/tabwriter" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func hostsCommand() cli.Command { diff --git a/command/ssh/inspect.go b/command/ssh/inspect.go index 824d79f6..4ba7b770 100644 --- a/command/ssh/inspect.go +++ b/command/ssh/inspect.go @@ -6,11 +6,11 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/sshutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/ssh/list.go b/command/ssh/list.go index 6c390402..b5e23c03 100644 --- a/command/ssh/list.go +++ b/command/ssh/list.go @@ -4,10 +4,10 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/sshutil" "github.com/smallstep/cli/errs" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" ) func listCommand() cli.Command { diff --git a/command/ssh/login.go b/command/ssh/login.go index 6e0072fe..f76d6f6f 100644 --- a/command/ssh/login.go +++ b/command/ssh/login.go @@ -8,7 +8,6 @@ import ( "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/keys" "github.com/smallstep/cli/crypto/sshutil" "github.com/smallstep/cli/errs" @@ -16,6 +15,7 @@ import ( "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/ssh/logout.go b/command/ssh/logout.go index 6de0400a..cb289090 100644 --- a/command/ssh/logout.go +++ b/command/ssh/logout.go @@ -4,12 +4,12 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/sshutil" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/ssh/proxycommand.go b/command/ssh/proxycommand.go index ebbf8398..2f13f8fd 100644 --- a/command/ssh/proxycommand.go +++ b/command/ssh/proxycommand.go @@ -13,7 +13,6 @@ import ( "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/keys" "github.com/smallstep/cli/crypto/sshutil" "github.com/smallstep/cli/errs" @@ -21,6 +20,7 @@ import ( "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/ssh/rekey.go b/command/ssh/rekey.go index 6f7b03c0..7ef2fa32 100644 --- a/command/ssh/rekey.go +++ b/command/ssh/rekey.go @@ -8,7 +8,6 @@ import ( "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca/identity" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/keys" "github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/errs" @@ -17,6 +16,7 @@ import ( "github.com/smallstep/cli/utils" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/ssh/renew.go b/command/ssh/renew.go index 4b68cb97..d5ee1227 100644 --- a/command/ssh/renew.go +++ b/command/ssh/renew.go @@ -9,13 +9,13 @@ import ( "github.com/pkg/errors" "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/ssh/revoke.go b/command/ssh/revoke.go index bc54a30c..3ff1bd9a 100644 --- a/command/ssh/revoke.go +++ b/command/ssh/revoke.go @@ -8,13 +8,13 @@ import ( "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/command" cmdca "github.com/smallstep/cli/command/ca" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/ssh/ssh.go b/command/ssh/ssh.go index 4bf6234f..171a7733 100644 --- a/command/ssh/ssh.go +++ b/command/ssh/ssh.go @@ -9,7 +9,6 @@ import ( "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/errs" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/crypto/keys" "github.com/smallstep/cli/crypto/sshutil" "github.com/smallstep/cli/flags" @@ -17,6 +16,7 @@ import ( "github.com/smallstep/cli/ui" "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" + "go.step.sm/cli-utils/command" "golang.org/x/crypto/ssh" ) diff --git a/command/version/version.go b/command/version/version.go index 082ac340..004548c4 100644 --- a/command/version/version.go +++ b/command/version/version.go @@ -5,8 +5,8 @@ import ( "github.com/urfave/cli" - "github.com/smallstep/cli/command" - "github.com/smallstep/cli/config" + "go.step.sm/cli-utils/command" + "go.step.sm/cli-utils/step" ) func init() { @@ -23,7 +23,7 @@ func init() { // Command prints out the current version of the tool func Command(c *cli.Context) error { - fmt.Printf("%s\n", config.Version()) - fmt.Printf("Release Date: %s\n", config.ReleaseDate()) + fmt.Printf("%s\n", step.Version()) + fmt.Printf("Release Date: %s\n", step.ReleaseDate()) return nil } diff --git a/config/config.go b/config/config.go deleted file mode 100644 index 4ee3e544..00000000 --- a/config/config.go +++ /dev/null @@ -1,136 +0,0 @@ -package config - -import ( - "fmt" - "log" - "os" - "os/user" - "path/filepath" - "runtime" - "strings" - "time" -) - -// version and buildTime are filled in during build by the Makefile -var ( - name = "Smallstep CLI" - buildTime = "N/A" - commit = "N/A" -) - -// StepPathEnv defines the name of the environment variable that can overwrite -// the default configuration path. -const StepPathEnv = "STEPPATH" - -// HomeEnv defines the name of the environment variable that can overwrite the -// default home directory. -const HomeEnv = "HOME" - -// stepPath will be populated in init() with the proper STEPPATH. -var stepPath string - -// homePath will be populated in init() with the proper HOME. -var homePath string - -// StepPath returns the path for the step configuration directory, this is -// defined by the environment variable STEPPATH or if this is not set it will -// default to '$HOME/.step'. -func StepPath() string { - return stepPath -} - -// Home returns the user home directory using the environment variable HOME or -// the os/user package. -func Home() string { - return homePath -} - -// StepAbs returns the given path relative to the StepPath if it's not an -// absolute path, relative to the home directory using the special string "~/", -// or relative to the working directory using "./" -// -// Relative paths like 'certs/root_ca.crt' will be converted to -// '$STEPPATH/certs/root_ca.crt', but paths like './certs/root_ca.crt' will be -// relative to the current directory. Home relative paths like -// ~/certs/root_ca.crt will be converted to '$HOME/certs/root_ca.crt'. And -// absolute paths like '/certs/root_ca.crt' will remain the same. -func StepAbs(path string) string { - if filepath.IsAbs(path) { - return path - } - // Windows accept both \ and / - slashed := filepath.ToSlash(path) - switch { - case strings.HasPrefix(slashed, "~/"): - return filepath.Join(homePath, path[2:]) - case strings.HasPrefix(slashed, "./"), strings.HasPrefix(slashed, "../"): - if abs, err := filepath.Abs(path); err == nil { - return abs - } - return path - default: - return filepath.Join(stepPath, path) - } -} - -func init() { - l := log.New(os.Stderr, "", 0) - - // Get home path from environment or from the user object. - homePath = os.Getenv(HomeEnv) - if homePath == "" { - usr, err := user.Current() - if err == nil && usr.HomeDir != "" { - homePath = usr.HomeDir - } else { - l.Fatalf("Error obtaining home directory, please define environment variable %s.", HomeEnv) - } - } - - // Get step path from environment or relative to home. - stepPath = os.Getenv(StepPathEnv) - if stepPath == "" { - stepPath = filepath.Join(homePath, ".step") - } - - // Check for presence or attempt to create it if necessary. - // - // Some environments (e.g. third party docker images) might fail creating - // the directory, so this should not panic if it can't. - if fi, err := os.Stat(stepPath); err != nil { - os.MkdirAll(stepPath, 0700) - } else if !fi.IsDir() { - l.Fatalf("File '%s' is not a directory.", stepPath) - } - // cleanup - homePath = filepath.Clean(homePath) - stepPath = filepath.Clean(stepPath) -} - -// Set updates the Version and ReleaseDate -func Set(n, v, t string) { - name = n - buildTime = t - commit = v -} - -// Version returns the current version of the binary -func Version() string { - out := commit - if commit == "N/A" { - out = "0000000-dev" - } - - return fmt.Sprintf("%s/%s (%s/%s)", - name, out, runtime.GOOS, runtime.GOARCH) -} - -// ReleaseDate returns the time of when the binary was built -func ReleaseDate() string { - out := buildTime - if buildTime == "N/A" { - out = time.Now().UTC().Format("2006-01-02 15:04 MST") - } - - return out -} diff --git a/crypto/sshutil/shell.go b/crypto/sshutil/shell.go index 71ec46ff..5d67a8b6 100644 --- a/crypto/sshutil/shell.go +++ b/crypto/sshutil/shell.go @@ -10,7 +10,7 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/config" + "go.step.sm/cli-utils/step" "golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh/knownhosts" "golang.org/x/term" @@ -182,7 +182,7 @@ func NewShell(user, address string, opts ...ShellOption) (*Shell, error) { address = formatAddress(address) // Use known_host as HostKeyCallback - knownHosts, err := knownhosts.New(filepath.Join(config.Home(), ".ssh", "known_hosts")) + knownHosts, err := knownhosts.New(filepath.Join(step.Home(), ".ssh", "known_hosts")) if err != nil { return nil, errors.Wrap(err, "error reading known_hosts") } diff --git a/flags/flags.go b/flags/flags.go index acfeab6e..53361e7e 100644 --- a/flags/flags.go +++ b/flags/flags.go @@ -10,10 +10,10 @@ import ( "github.com/pkg/errors" "github.com/smallstep/certificates/api" - "github.com/smallstep/cli/config" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/utils" "github.com/urfave/cli" + "go.step.sm/cli-utils/step" ) var ( @@ -199,7 +199,7 @@ but can accept a different configuration file using **--ca-config** flag.`, Name: "ca-config", Usage: `The certificate authority configuration . Defaults to $STEPPATH/config/ca.json`, - Value: filepath.Join(config.StepPath(), "config", "ca.json"), + Value: filepath.Join(step.Path(), "config", "ca.json"), } // AdminCert is a cli.Flag used to pass the x5c header certificate for a JWT. diff --git a/go.mod b/go.mod index d14ada6a..2d4b5925 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( github.com/stretchr/testify v1.7.0 github.com/urfave/cli v1.22.5 go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 + go.step.sm/cli-utils v0.6.0 go.step.sm/crypto v0.11.0 go.step.sm/linkedca v0.7.0 golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 @@ -36,8 +37,11 @@ require ( software.sslmate.com/src/go-pkcs12 v0.0.0-20201103104416-57fc603b7f52 ) -// replace github.com/smallstep/certificates => ../certificates +replace github.com/smallstep/certificates => ../certificates + // replace github.com/smallstep/certinfo => ../certinfo // replace go.step.sm/linkedca => ../linkedca -// replace go.step.sm/cli-utils => ../cli-utils + +replace go.step.sm/cli-utils => ../cli-utils + // replace go.step.sm/crypto => ../crypto diff --git a/go.sum b/go.sum index 71ecaeed..9e5c2a8a 100644 --- a/go.sum +++ b/go.sum @@ -954,8 +954,11 @@ go.opentelemetry.io/otel/trace v0.20.0 h1:1DL6EXUdcg95gukhuRRvLDO/4X5THh/5dIV52l go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= go.opentelemetry.io/proto/otlp v0.7.0 h1:rwOQPCuKAKmwGKq2aVNnYIibI6wnV7EvzgfTCzcdGg8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +<<<<<<< HEAD go.step.sm/cli-utils v0.6.0 h1:sH4FxBcjmbxyilKXheSyJuKF/QjpojpiW90ERwUWOgQ= go.step.sm/cli-utils v0.6.0/go.mod h1:jklBMavFl2PbmGlyxgax08ZnB0uWpadjuOlSKKXz+0U= +======= +>>>>>>> 264c0e5 (Initial step path contexts commit) go.step.sm/crypto v0.9.0/go.mod h1:+CYG05Mek1YDqi5WK0ERc6cOpKly2i/a5aZmU1sfGj0= go.step.sm/crypto v0.11.0 h1:VDpeVgEmqme/FK2w5QINxkOQ1FWOm/Wi2TwQXiacKr8= go.step.sm/crypto v0.11.0/go.mod h1:5YzQ85BujYBu6NH18jw7nFjwuRnDch35nLzH0ES5sKg= diff --git a/utils/write.go b/utils/write.go index afc8602a..1e9f6563 100644 --- a/utils/write.go +++ b/utils/write.go @@ -11,9 +11,9 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/command" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/ui" + "go.step.sm/cli-utils/command" ) var (