From de85fd0cef6225f25f3c467ec3cf3b22d8844751 Mon Sep 17 00:00:00 2001 From: Herman Slatman Date: Fri, 13 Sep 2024 00:00:18 +0200 Subject: [PATCH 1/3] Use `github.com/smallstep/cli-utils` and reorder imports --- command/README.md | 6 +++--- command/api/api.go | 6 ++++-- command/api/token/create.go | 5 +++-- command/base64/base64.go | 6 ++++-- command/beta/beta.go | 6 ++++-- command/ca/acme/eab/add.go | 4 ++-- command/ca/acme/eab/list.go | 3 ++- command/ca/acme/eab/remove.go | 2 +- command/ca/admin/add.go | 8 +++++--- command/ca/admin/admin.go | 6 +++--- command/ca/admin/list.go | 8 +++++--- command/ca/admin/remove.go | 6 ++++-- command/ca/admin/update.go | 8 +++++--- command/ca/bootstrap.go | 8 +++++--- command/ca/ca.go | 6 ++++-- command/ca/certificate.go | 14 ++++++++------ command/ca/federation.go | 12 +++++++----- command/ca/health.go | 6 ++++-- command/ca/init.go | 19 +++++++++---------- command/ca/policy/actions/cn.go | 3 ++- command/ca/policy/actions/dns.go | 3 ++- command/ca/policy/actions/emails.go | 3 ++- command/ca/policy/actions/ips.go | 3 ++- command/ca/policy/actions/policy.go | 4 ++-- command/ca/policy/actions/principals.go | 3 ++- command/ca/policy/actions/remove.go | 6 ++++-- command/ca/policy/actions/uris.go | 3 ++- command/ca/policy/actions/view.go | 8 +++++--- command/ca/provisioner/add.go | 12 +++++++----- command/ca/provisioner/caConfigClient.go | 3 ++- command/ca/provisioner/getEncryptedKey.go | 6 ++++-- command/ca/provisioner/list.go | 6 ++++-- command/ca/provisioner/provisioner.go | 10 ++++++---- command/ca/provisioner/remove.go | 5 +++-- command/ca/provisioner/update.go | 15 +++++++++------ command/ca/provisioner/webhook/add.go | 8 +++++--- command/ca/provisioner/webhook/remove.go | 6 ++++-- command/ca/provisioner/webhook/update.go | 8 +++++--- command/ca/provisioner/webhook/webhook.go | 10 ++++++---- command/ca/rekey.go | 14 ++++++++------ command/ca/renew.go | 16 +++++++++------- command/ca/revoke.go | 14 ++++++++------ command/ca/root.go | 11 ++++++----- command/ca/sign.go | 12 +++++++----- command/ca/token.go | 12 +++++++----- command/certificate/bundle.go | 10 ++++++---- command/certificate/certificate.go | 3 ++- command/certificate/create.go | 14 ++++++++------ command/certificate/fingerprint.go | 8 +++++--- command/certificate/format.go | 10 ++++++---- command/certificate/inspect.go | 10 ++++++---- command/certificate/install.go | 4 ++-- command/certificate/key.go | 12 +++++++----- command/certificate/lint.go | 8 +++++--- command/certificate/needsRenewal.go | 6 ++++-- command/certificate/p12.go | 14 ++++++++------ command/certificate/sign.go | 11 ++++++----- command/certificate/verify.go | 10 ++++++---- command/completion/completion.go | 8 +++++--- command/context/context.go | 3 ++- command/context/current.go | 8 +++++--- command/context/list.go | 8 +++++--- command/context/remove.go | 14 ++++++++------ command/context/select.go | 12 +++++++----- command/crl/crl.go | 3 ++- command/crl/inspect.go | 12 +++++++----- command/crypto/change-pass.go | 12 +++++++----- command/crypto/crypto.go | 6 ++++-- command/crypto/hash/hash.go | 6 ++++-- command/crypto/jwe/decrypt.go | 9 +++++---- command/crypto/jwe/encrypt.go | 10 ++++++---- command/crypto/jwk/create.go | 12 +++++++----- command/crypto/jwk/keyset.go | 8 +++++--- command/crypto/jwk/public.go | 3 ++- command/crypto/jwk/thumbprint.go | 3 ++- command/crypto/jws/inspect.go | 8 +++++--- command/crypto/jws/sign.go | 3 ++- command/crypto/jws/verify.go | 8 +++++--- command/crypto/jwt/inspect.go | 6 ++++-- command/crypto/jwt/sign.go | 6 ++++-- command/crypto/jwt/verify.go | 8 +++++--- command/crypto/kdf/kdf.go | 6 ++++-- command/crypto/key/fingerprint.go | 8 +++++--- command/crypto/key/format.go | 10 ++++++---- command/crypto/key/inspect.go | 8 +++++--- command/crypto/key/public.go | 12 +++++++----- command/crypto/key/sign.go | 8 +++++--- command/crypto/key/verify.go | 8 +++++--- command/crypto/keypair.go | 12 +++++++----- command/crypto/nacl/auth.go | 6 ++++-- command/crypto/nacl/box.go | 12 +++++++----- command/crypto/nacl/secretbox.go | 6 ++++-- command/crypto/nacl/sign.go | 12 +++++++----- command/crypto/otp/generate.go | 8 +++++--- command/crypto/otp/verify.go | 6 ++++-- command/crypto/rand/rand.go | 6 ++++-- command/crypto/winpe/winpe.go | 3 ++- command/fileserver/fileserver.go | 7 ++++--- command/oauth/cmd.go | 12 +++++++----- command/path/path.go | 5 +++-- command/ssh/certificate.go | 18 ++++++++++-------- command/ssh/checkHost.go | 10 ++++++---- command/ssh/config.go | 14 ++++++++------ command/ssh/fingerprint.go | 8 +++++--- command/ssh/hosts.go | 8 +++++--- command/ssh/inspect.go | 10 ++++++---- command/ssh/list.go | 9 ++++++--- command/ssh/login.go | 14 ++++++++------ command/ssh/logout.go | 10 ++++++---- command/ssh/needsRenewal.go | 8 +++++--- command/ssh/proxycommand.go | 12 +++++++----- command/ssh/rekey.go | 17 ++++++++++------- command/ssh/renew.go | 15 ++++++++------- command/ssh/revoke.go | 12 +++++++----- command/ssh/ssh.go | 12 +++++++----- command/version/version.go | 7 ++++--- flags/flags.go | 10 ++++++---- go.mod | 1 + go.sum | 2 ++ integration/help_quality_test.go | 2 +- internal/plugin/plugin.go | 3 ++- internal/sshutil/shell.go | 3 ++- utils/cautils/acme_flow.go | 3 ++- utils/cautils/acmeutils.go | 12 ++++++------ utils/cautils/bootstrap.go | 12 +++++++----- utils/cautils/certificate_flow.go | 16 +++++++++------- utils/cautils/client.go | 11 +++++++---- utils/cautils/token_flow.go | 8 +++++--- utils/cautils/token_generator.go | 14 ++++++++------ utils/cautils/tpm.go | 7 ++++--- utils/cli.go | 3 ++- utils/file.go | 2 +- utils/read.go | 7 ++++--- utils/write.go | 6 +++--- 134 files changed, 659 insertions(+), 441 deletions(-) diff --git a/command/README.md b/command/README.md index af6e17aa9..0e26c9fbc 100644 --- a/command/README.md +++ b/command/README.md @@ -12,7 +12,7 @@ should exist within its own package if possible. For example, `version` and Any package used by a command but does not contain explicit business logic directly related to the command should exist in the top-level of this repository. For example, the `github.com/smallstep/cli/flags` and -`go.step.sm/cli-utils/errs` package are used by many different commands and +`github.com/smallstep/cli-utils/errs` package are used by many different commands and contain functionality for defining flags and creating/manipulating errors. ### Adding a Command @@ -70,8 +70,8 @@ There are three packages which contain functionality to make writing commands ea - `github.com/smallstep/cli/flags` - `github.com/smallstep/cli/prompts` -- `go.step.sm/cli-utils/errs` -- `go.step.sm/cli-utils/usage` +- `github.com/smallstep/cli-utils/errs` +- `github.com/smallstep/cli-utils/usage` The usage package is used to extend the default documentation provided by `urfave/cli` by enabling us to document arguments, whether they are optional or diff --git a/command/api/api.go b/command/api/api.go index 06f234373..457cdeb11 100644 --- a/command/api/api.go +++ b/command/api/api.go @@ -1,9 +1,11 @@ package api import ( - "github.com/smallstep/cli/command/api/token" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" + + "github.com/smallstep/cli-utils/command" + + "github.com/smallstep/cli/command/api/token" ) func init() { diff --git a/command/api/token/create.go b/command/api/token/create.go index 689c3d980..3d5a2fd29 100644 --- a/command/api/token/create.go +++ b/command/api/token/create.go @@ -12,8 +12,9 @@ import ( "github.com/google/uuid" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" ) func createCommand() cli.Command { diff --git a/command/base64/base64.go b/command/base64/base64.go index 17e7495f4..32b8c1ea6 100644 --- a/command/base64/base64.go +++ b/command/base64/base64.go @@ -8,9 +8,11 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" + + "github.com/smallstep/cli-utils/command" + + "github.com/smallstep/cli/utils" ) func init() { diff --git a/command/beta/beta.go b/command/beta/beta.go index dc2c827a9..5b5073782 100644 --- a/command/beta/beta.go +++ b/command/beta/beta.go @@ -1,9 +1,11 @@ package beta import ( - "github.com/smallstep/cli/command/ca" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" + + "github.com/smallstep/cli-utils/command" + + "github.com/smallstep/cli/command/ca" ) // init creates and registers the ca command diff --git a/command/ca/acme/eab/add.go b/command/ca/acme/eab/add.go index ead3e379e..2fe70c794 100644 --- a/command/ca/acme/eab/add.go +++ b/command/ca/acme/eab/add.go @@ -7,9 +7,9 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - adminAPI "github.com/smallstep/certificates/authority/admin/api" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" ) diff --git a/command/ca/acme/eab/list.go b/command/ca/acme/eab/list.go index 0bc3aeefc..f0518986b 100644 --- a/command/ca/acme/eab/list.go +++ b/command/ca/acme/eab/list.go @@ -8,9 +8,10 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" ) diff --git a/command/ca/acme/eab/remove.go b/command/ca/acme/eab/remove.go index 655c1be48..857a4df1a 100644 --- a/command/ca/acme/eab/remove.go +++ b/command/ca/acme/eab/remove.go @@ -6,7 +6,7 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + "github.com/smallstep/cli-utils/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" diff --git a/command/ca/admin/add.go b/command/ca/admin/add.go index a7f22d181..cdcf2c9cb 100644 --- a/command/ca/admin/add.go +++ b/command/ca/admin/add.go @@ -5,12 +5,14 @@ import ( "os" "text/tabwriter" + "github.com/urfave/cli" + adminAPI "github.com/smallstep/certificates/authority/admin/api" + "github.com/smallstep/cli-utils/errs" + "go.step.sm/linkedca" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/linkedca" ) func addCommand() cli.Command { diff --git a/command/ca/admin/admin.go b/command/ca/admin/admin.go index 9190e3d39..61360ba2b 100644 --- a/command/ca/admin/admin.go +++ b/command/ca/admin/admin.go @@ -4,11 +4,11 @@ import ( "errors" "fmt" - "github.com/smallstep/certificates/ca" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/linkedca" ) diff --git a/command/ca/admin/list.go b/command/ca/admin/list.go index 890f646d6..3504b84bf 100644 --- a/command/ca/admin/list.go +++ b/command/ca/admin/list.go @@ -5,11 +5,13 @@ import ( "os" "text/tabwriter" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils/cautils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/linkedca" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils/cautils" ) func listCommand() cli.Command { diff --git a/command/ca/admin/remove.go b/command/ca/admin/remove.go index d8eedd36e..40caf5d2e 100644 --- a/command/ca/admin/remove.go +++ b/command/ca/admin/remove.go @@ -1,10 +1,12 @@ package admin import ( + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" ) func removeCommand() cli.Command { diff --git a/command/ca/admin/update.go b/command/ca/admin/update.go index ad8f78209..fde48f806 100644 --- a/command/ca/admin/update.go +++ b/command/ca/admin/update.go @@ -5,12 +5,14 @@ import ( "os" "text/tabwriter" + "github.com/urfave/cli" + adminAPI "github.com/smallstep/certificates/authority/admin/api" + "github.com/smallstep/cli-utils/errs" + "go.step.sm/linkedca" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/linkedca" ) func updateCommand() cli.Command { diff --git a/command/ca/bootstrap.go b/command/ca/bootstrap.go index 28ef6a42b..1d28f3b93 100644 --- a/command/ca/bootstrap.go +++ b/command/ca/bootstrap.go @@ -3,11 +3,13 @@ package ca import ( "strings" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" ) func bootstrapCommand() cli.Command { diff --git a/command/ca/ca.go b/command/ca/ca.go index 6482fd2b1..bd5e68c5d 100644 --- a/command/ca/ca.go +++ b/command/ca/ca.go @@ -1,12 +1,14 @@ package ca import ( + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli/command/ca/acme" "github.com/smallstep/cli/command/ca/admin" "github.com/smallstep/cli/command/ca/policy" "github.com/smallstep/cli/command/ca/provisioner" - "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 b5a321ca3..a5d59febc 100644 --- a/command/ca/certificate.go +++ b/command/ca/certificate.go @@ -5,15 +5,17 @@ import ( "strings" "github.com/pkg/errors" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/pemutil" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/token" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/pemutil" ) func certificateCommand() cli.Command { diff --git a/command/ca/federation.go b/command/ca/federation.go index af971e29e..954753773 100644 --- a/command/ca/federation.go +++ b/command/ca/federation.go @@ -6,16 +6,18 @@ import ( "os" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/pemutil" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/pemutil" ) type flowType int diff --git a/command/ca/health.go b/command/ca/health.go index 2893a06c5..3ad013c5a 100644 --- a/command/ca/health.go +++ b/command/ca/health.go @@ -5,11 +5,13 @@ import ( "fmt" "os" + "github.com/urfave/cli" + "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" ) func healthCommand() cli.Command { diff --git a/command/ca/init.go b/command/ca/init.go index 94aadd747..52871389a 100644 --- a/command/ca/init.go +++ b/command/ca/init.go @@ -14,21 +14,20 @@ import ( "github.com/manifoldco/promptui" "github.com/pkg/errors" - "github.com/smallstep/certificates/cas/apiv1" - "github.com/smallstep/certificates/pki" - "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/errs" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/certificates/cas/apiv1" + "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/kms" + _ "go.step.sm/crypto/kms/azurekms" // enable azurekms "go.step.sm/crypto/pemutil" - // Enable azurekms - _ "go.step.sm/crypto/kms/azurekms" + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" + "github.com/smallstep/cli/utils/cautils" ) func initCommand() cli.Command { diff --git a/command/ca/policy/actions/cn.go b/command/ca/policy/actions/cn.go index 731a8def9..eba4777a7 100644 --- a/command/ca/policy/actions/cn.go +++ b/command/ca/policy/actions/cn.go @@ -6,7 +6,8 @@ import ( "fmt" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "github.com/smallstep/cli/command/ca/policy/policycontext" "github.com/smallstep/cli/flags" diff --git a/command/ca/policy/actions/dns.go b/command/ca/policy/actions/dns.go index b163b0fea..22d92723c 100644 --- a/command/ca/policy/actions/dns.go +++ b/command/ca/policy/actions/dns.go @@ -6,7 +6,8 @@ import ( "fmt" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "github.com/smallstep/cli/command/ca/policy/policycontext" "github.com/smallstep/cli/flags" diff --git a/command/ca/policy/actions/emails.go b/command/ca/policy/actions/emails.go index e426e8577..57f69d0de 100644 --- a/command/ca/policy/actions/emails.go +++ b/command/ca/policy/actions/emails.go @@ -6,7 +6,8 @@ import ( "fmt" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "github.com/smallstep/cli/command/ca/policy/policycontext" "github.com/smallstep/cli/flags" diff --git a/command/ca/policy/actions/ips.go b/command/ca/policy/actions/ips.go index e394b8ecf..7c088917f 100644 --- a/command/ca/policy/actions/ips.go +++ b/command/ca/policy/actions/ips.go @@ -6,7 +6,8 @@ import ( "fmt" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "github.com/smallstep/cli/command/ca/policy/policycontext" "github.com/smallstep/cli/flags" diff --git a/command/ca/policy/actions/policy.go b/command/ca/policy/actions/policy.go index 04b6cd558..c09ce44f9 100644 --- a/command/ca/policy/actions/policy.go +++ b/command/ca/policy/actions/policy.go @@ -10,10 +10,10 @@ import ( "github.com/urfave/cli" "google.golang.org/protobuf/encoding/protojson" - "go.step.sm/cli-utils/errs" + "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/errs" "go.step.sm/linkedca" - "github.com/smallstep/certificates/ca" "github.com/smallstep/cli/command/ca/policy/policycontext" "github.com/smallstep/cli/internal/command" ) diff --git a/command/ca/policy/actions/principals.go b/command/ca/policy/actions/principals.go index 1c744bf15..c55f8cc2d 100644 --- a/command/ca/policy/actions/principals.go +++ b/command/ca/policy/actions/principals.go @@ -6,7 +6,8 @@ import ( "fmt" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "github.com/smallstep/cli/command/ca/policy/policycontext" "github.com/smallstep/cli/flags" diff --git a/command/ca/policy/actions/remove.go b/command/ca/policy/actions/remove.go index 6cb7528bb..cef54dfc1 100644 --- a/command/ca/policy/actions/remove.go +++ b/command/ca/policy/actions/remove.go @@ -5,13 +5,15 @@ import ( "errors" "fmt" + "github.com/urfave/cli" + "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/command/ca/policy/policycontext" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/command" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" ) // RemoveCommand returns the policy remove subcommand. diff --git a/command/ca/policy/actions/uris.go b/command/ca/policy/actions/uris.go index 46e4ea97b..f8e5557ec 100644 --- a/command/ca/policy/actions/uris.go +++ b/command/ca/policy/actions/uris.go @@ -6,7 +6,8 @@ import ( "fmt" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "github.com/smallstep/cli/command/ca/policy/policycontext" "github.com/smallstep/cli/flags" diff --git a/command/ca/policy/actions/view.go b/command/ca/policy/actions/view.go index 01f0c189c..92499be6e 100644 --- a/command/ca/policy/actions/view.go +++ b/command/ca/policy/actions/view.go @@ -5,14 +5,16 @@ import ( "errors" "fmt" + "github.com/urfave/cli" + "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/errs" + "go.step.sm/linkedca" + "github.com/smallstep/cli/command/ca/policy/policycontext" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/command" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/linkedca" ) // ViewCommand returns the policy view subcommand diff --git a/command/ca/provisioner/add.go b/command/ca/provisioner/add.go index 3f61988c3..c8c0f2070 100644 --- a/command/ca/provisioner/add.go +++ b/command/ca/provisioner/add.go @@ -13,15 +13,17 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/internal/sliceutil" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" "go.step.sm/crypto/pemutil" "go.step.sm/linkedca" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/internal/sliceutil" + "github.com/smallstep/cli/utils" ) func addCommand() cli.Command { diff --git a/command/ca/provisioner/caConfigClient.go b/command/ca/provisioner/caConfigClient.go index 9054e169d..491a9ff72 100644 --- a/command/ca/provisioner/caConfigClient.go +++ b/command/ca/provisioner/caConfigClient.go @@ -4,11 +4,12 @@ import ( "context" "github.com/pkg/errors" + "github.com/smallstep/certificates/authority" "github.com/smallstep/certificates/authority/config" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/ui" "go.step.sm/linkedca" ) diff --git a/command/ca/provisioner/getEncryptedKey.go b/command/ca/provisioner/getEncryptedKey.go index 00c61df6c..1c9a78b8c 100644 --- a/command/ca/provisioner/getEncryptedKey.go +++ b/command/ca/provisioner/getEncryptedKey.go @@ -4,10 +4,12 @@ import ( "fmt" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" ) func getEncryptedKeyCommand() cli.Command { diff --git a/command/ca/provisioner/list.go b/command/ca/provisioner/list.go index cebd0bc1b..4e5efeec6 100644 --- a/command/ca/provisioner/list.go +++ b/command/ca/provisioner/list.go @@ -5,10 +5,12 @@ import ( "fmt" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" ) func listCommand() cli.Command { diff --git a/command/ca/provisioner/provisioner.go b/command/ca/provisioner/provisioner.go index 1096f7bd3..4d53460ed 100644 --- a/command/ca/provisioner/provisioner.go +++ b/command/ca/provisioner/provisioner.go @@ -8,16 +8,18 @@ import ( "github.com/pkg/errors" nebula "github.com/slackhq/nebula/cert" + "github.com/urfave/cli" + "github.com/smallstep/certificates/authority/config" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/linkedca" + "github.com/smallstep/cli/command/ca/provisioner/webhook" "github.com/smallstep/cli/utils" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "go.step.sm/linkedca" ) // Command returns the jwk subcommand. diff --git a/command/ca/provisioner/remove.go b/command/ca/provisioner/remove.go index 3fd6c59d4..f4d0855e0 100644 --- a/command/ca/provisioner/remove.go +++ b/command/ca/provisioner/remove.go @@ -1,10 +1,11 @@ package provisioner import ( + "github.com/urfave/cli" + "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/errs" "github.com/smallstep/cli/flags" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" ) func removeCommand() cli.Command { diff --git a/command/ca/provisioner/update.go b/command/ca/provisioner/update.go index 9a8a7bbfb..9db64796c 100644 --- a/command/ca/provisioner/update.go +++ b/command/ca/provisioner/update.go @@ -11,16 +11,19 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/internal/sliceutil" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/jose" "go.step.sm/crypto/pemutil" "go.step.sm/linkedca" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/internal/sliceutil" + "github.com/smallstep/cli/utils" ) func updateCommand() cli.Command { diff --git a/command/ca/provisioner/webhook/add.go b/command/ca/provisioner/webhook/add.go index 5da017439..6a28bf76c 100644 --- a/command/ca/provisioner/webhook/add.go +++ b/command/ca/provisioner/webhook/add.go @@ -3,11 +3,13 @@ package webhook import ( "fmt" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/linkedca" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func addCommand() cli.Command { diff --git a/command/ca/provisioner/webhook/remove.go b/command/ca/provisioner/webhook/remove.go index 1dc027fb3..26b037809 100644 --- a/command/ca/provisioner/webhook/remove.go +++ b/command/ca/provisioner/webhook/remove.go @@ -1,9 +1,11 @@ package webhook import ( - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" + + "github.com/smallstep/cli/flags" ) func removeCommand() cli.Command { diff --git a/command/ca/provisioner/webhook/update.go b/command/ca/provisioner/webhook/update.go index 95f17bbd4..cdbcc30c7 100644 --- a/command/ca/provisioner/webhook/update.go +++ b/command/ca/provisioner/webhook/update.go @@ -4,12 +4,14 @@ import ( "errors" "fmt" + "github.com/urfave/cli" + "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/errs" + "go.step.sm/linkedca" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/linkedca" ) func updateCommand() cli.Command { diff --git a/command/ca/provisioner/webhook/webhook.go b/command/ca/provisioner/webhook/webhook.go index be3391943..d84752317 100644 --- a/command/ca/provisioner/webhook/webhook.go +++ b/command/ca/provisioner/webhook/webhook.go @@ -5,13 +5,15 @@ import ( "fmt" "os" + "github.com/urfave/cli" + "github.com/smallstep/certificates/authority/config" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/linkedca" + + "github.com/smallstep/cli/utils/cautils" ) // Command returns the webhook subcommand. diff --git a/command/ca/rekey.go b/command/ca/rekey.go index d72d84c6b..0128f6991 100644 --- a/command/ca/rekey.go +++ b/command/ca/rekey.go @@ -10,15 +10,17 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/keyutil" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func rekeyCertificateCommand() cli.Command { diff --git a/command/ca/renew.go b/command/ca/renew.go index d37de7cd7..c422f5094 100644 --- a/command/ca/renew.go +++ b/command/ca/renew.go @@ -20,21 +20,23 @@ import ( "time" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/jose" + "go.step.sm/crypto/pemutil" + "go.step.sm/crypto/x509util" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/token" "github.com/smallstep/cli/utils" "github.com/smallstep/cli/utils/cautils" "github.com/smallstep/cli/utils/sysutils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/jose" - "go.step.sm/crypto/pemutil" - "go.step.sm/crypto/x509util" ) func renewCertificateCommand() cli.Command { diff --git a/command/ca/revoke.go b/command/ca/revoke.go index 0f3d2fbfd..2d5415eed 100644 --- a/command/ca/revoke.go +++ b/command/ca/revoke.go @@ -13,20 +13,22 @@ import ( "time" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" "go.step.sm/crypto/pemutil" "go.step.sm/crypto/x509util" "golang.org/x/crypto/ocsp" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils/cautils" ) /* diff --git a/command/ca/root.go b/command/ca/root.go index 9e1ca03c9..9bbaaa2cb 100644 --- a/command/ca/root.go +++ b/command/ca/root.go @@ -6,14 +6,15 @@ import ( "strings" "github.com/pkg/errors" + "github.com/urfave/cli" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/flags" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" ) func rootCommand() cli.Command { diff --git a/command/ca/sign.go b/command/ca/sign.go index a99b71de3..5129aa897 100644 --- a/command/ca/sign.go +++ b/command/ca/sign.go @@ -5,15 +5,17 @@ import ( "strings" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/api" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/pemutil" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/token" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/pemutil" ) func signCertificateCommand() cli.Command { diff --git a/command/ca/token.go b/command/ca/token.go index 1df9aec1f..7a1e10021 100644 --- a/command/ca/token.go +++ b/command/ca/token.go @@ -5,16 +5,18 @@ import ( "os" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "go.step.sm/crypto/pemutil" + "golang.org/x/crypto/ssh" + "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" - "go.step.sm/cli-utils/errs" - "go.step.sm/crypto/pemutil" - "golang.org/x/crypto/ssh" ) func tokenCommand() cli.Command { diff --git a/command/certificate/bundle.go b/command/certificate/bundle.go index a6d06235a..427eabfad 100644 --- a/command/certificate/bundle.go +++ b/command/certificate/bundle.go @@ -5,12 +5,14 @@ import ( "os" "github.com/pkg/errors" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" ) func bundleCommand() cli.Command { diff --git a/command/certificate/certificate.go b/command/certificate/certificate.go index 5aa3dbd32..442b59dd4 100644 --- a/command/certificate/certificate.go +++ b/command/certificate/certificate.go @@ -2,7 +2,8 @@ package certificate import ( "github.com/urfave/cli" - "go.step.sm/cli-utils/command" + + "github.com/smallstep/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 cd491c5f7..0cd897ebc 100644 --- a/command/certificate/create.go +++ b/command/certificate/create.go @@ -7,16 +7,18 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/internal/cryptoutil" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/keyutil" "go.step.sm/crypto/pemutil" "go.step.sm/crypto/x509util" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/internal/cryptoutil" + "github.com/smallstep/cli/utils" ) const ( diff --git a/command/certificate/fingerprint.go b/command/certificate/fingerprint.go index fcdefc4db..edac36938 100644 --- a/command/certificate/fingerprint.go +++ b/command/certificate/fingerprint.go @@ -9,12 +9,14 @@ import ( _ "crypto/sha1" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/fingerprint" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func fingerprintCommand() cli.Command { diff --git a/command/certificate/format.go b/command/certificate/format.go index 430b6d8f9..f68cae0e1 100644 --- a/command/certificate/format.go +++ b/command/certificate/format.go @@ -7,12 +7,14 @@ import ( "os" "github.com/pkg/errors" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" ) func formatCommand() cli.Command { diff --git a/command/certificate/inspect.go b/command/certificate/inspect.go index 1f56443f8..7d465b349 100644 --- a/command/certificate/inspect.go +++ b/command/certificate/inspect.go @@ -9,13 +9,15 @@ import ( "os" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certinfo" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" + "github.com/smallstep/cli-utils/errs" zx509 "github.com/smallstep/zcrypto/x509" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func inspectCommand() cli.Command { diff --git a/command/certificate/install.go b/command/certificate/install.go index aa1296297..cab7524e0 100644 --- a/command/certificate/install.go +++ b/command/certificate/install.go @@ -9,9 +9,9 @@ import ( "github.com/urfave/cli" "github.com/smallstep/certinfo" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" "github.com/smallstep/truststore" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" "go.step.sm/crypto/pemutil" ) diff --git a/command/certificate/key.go b/command/certificate/key.go index d3cd2d3ac..c7f66237f 100644 --- a/command/certificate/key.go +++ b/command/certificate/key.go @@ -4,13 +4,15 @@ import ( "encoding/pem" "fmt" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func keyCommand() cli.Command { diff --git a/command/certificate/lint.go b/command/certificate/lint.go index e0669a53e..8eecde2b3 100644 --- a/command/certificate/lint.go +++ b/command/certificate/lint.go @@ -6,11 +6,13 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/errs" zx509 "github.com/smallstep/zcrypto/x509" "github.com/smallstep/zlint" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli/flags" ) func lintCommand() cli.Command { diff --git a/command/certificate/needsRenewal.go b/command/certificate/needsRenewal.go index 6a228f173..399ef0c32 100644 --- a/command/certificate/needsRenewal.go +++ b/command/certificate/needsRenewal.go @@ -9,10 +9,12 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" ) const defaultPercentUsedThreshold = 66 diff --git a/command/certificate/p12.go b/command/certificate/p12.go index 5caf8d482..f555bd092 100644 --- a/command/certificate/p12.go +++ b/command/certificate/p12.go @@ -5,15 +5,17 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "software.sslmate.com/src/go-pkcs12" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/pemutil" "go.step.sm/crypto/x509util" - "software.sslmate.com/src/go-pkcs12" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func p12Command() cli.Command { diff --git a/command/certificate/sign.go b/command/certificate/sign.go index ea0d992c9..628a391cf 100644 --- a/command/certificate/sign.go +++ b/command/certificate/sign.go @@ -12,14 +12,15 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/internal/cryptoutil" - "github.com/smallstep/cli/utils" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" "go.step.sm/crypto/pemutil" "go.step.sm/crypto/x509util" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/internal/cryptoutil" + "github.com/smallstep/cli/utils" ) const customIntermediateTemplate = `{ diff --git a/command/certificate/verify.go b/command/certificate/verify.go index b17102cb7..81e34706a 100644 --- a/command/certificate/verify.go +++ b/command/certificate/verify.go @@ -11,12 +11,14 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/internal/crlutil" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/crypto/x509util" "golang.org/x/crypto/ocsp" + + "github.com/smallstep/cli-utils/errs" + "go.step.sm/crypto/x509util" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/internal/crlutil" ) func verifyCommand() cli.Command { diff --git a/command/completion/completion.go b/command/completion/completion.go index 54fa194ec..55edfa2bb 100644 --- a/command/completion/completion.go +++ b/command/completion/completion.go @@ -4,10 +4,12 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + + "github.com/smallstep/cli/flags" ) func init() { diff --git a/command/context/context.go b/command/context/context.go index a6c11556a..9adca660a 100644 --- a/command/context/context.go +++ b/command/context/context.go @@ -2,7 +2,8 @@ package context import ( "github.com/urfave/cli" - "go.step.sm/cli-utils/command" + + "github.com/smallstep/cli-utils/command" ) // init creates and registers the ca command diff --git a/command/context/current.go b/command/context/current.go index 96c41fb79..fdda33ee4 100644 --- a/command/context/current.go +++ b/command/context/current.go @@ -5,10 +5,12 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/step" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/step" + + "github.com/smallstep/cli/flags" ) func currentCommand() cli.Command { diff --git a/command/context/list.go b/command/context/list.go index 33803cc5b..2d0e585ed 100644 --- a/command/context/list.go +++ b/command/context/list.go @@ -3,10 +3,12 @@ package context import ( "fmt" - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/step" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/step" + + "github.com/smallstep/cli/flags" ) func listCommand() cli.Command { diff --git a/command/context/remove.go b/command/context/remove.go index c047d31cb..c0c93eacf 100644 --- a/command/context/remove.go +++ b/command/context/remove.go @@ -6,13 +6,15 @@ import ( "path/filepath" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/fileutil" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/fileutil" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" + + "github.com/smallstep/cli/flags" ) func removeCommand() cli.Command { diff --git a/command/context/select.go b/command/context/select.go index 03a8639ac..731ef4641 100644 --- a/command/context/select.go +++ b/command/context/select.go @@ -1,12 +1,14 @@ package context import ( - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" + + "github.com/smallstep/cli/flags" ) func selectCommand() cli.Command { diff --git a/command/crl/crl.go b/command/crl/crl.go index 1c5530f26..0e592fe9c 100644 --- a/command/crl/crl.go +++ b/command/crl/crl.go @@ -2,7 +2,8 @@ package crl import ( "github.com/urfave/cli" - "go.step.sm/cli-utils/command" + + "github.com/smallstep/cli-utils/command" ) // init creates and registers the crl command diff --git a/command/crl/inspect.go b/command/crl/inspect.go index 27f747f6c..ece9b6946 100644 --- a/command/crl/inspect.go +++ b/command/crl/inspect.go @@ -14,14 +14,16 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/internal/crlutil" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/pemutil" "go.step.sm/crypto/x509util" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/internal/crlutil" + "github.com/smallstep/cli/utils" ) func inspectCommand() cli.Command { diff --git a/command/crypto/change-pass.go b/command/crypto/change-pass.go index e47f51c21..92c419455 100644 --- a/command/crypto/change-pass.go +++ b/command/crypto/change-pass.go @@ -7,14 +7,16 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func changePassCommand() cli.Command { diff --git a/command/crypto/crypto.go b/command/crypto/crypto.go index f150b00ae..45cd43bb3 100644 --- a/command/crypto/crypto.go +++ b/command/crypto/crypto.go @@ -1,6 +1,10 @@ package crypto import ( + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli/command/crypto/hash" "github.com/smallstep/cli/command/crypto/jose" "github.com/smallstep/cli/command/crypto/jwe" @@ -13,8 +17,6 @@ import ( "github.com/smallstep/cli/command/crypto/otp" "github.com/smallstep/cli/command/crypto/rand" "github.com/smallstep/cli/command/crypto/winpe" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" ) func init() { diff --git a/command/crypto/hash/hash.go b/command/crypto/hash/hash.go index c57e5406d..0c997adb2 100644 --- a/command/crypto/hash/hash.go +++ b/command/crypto/hash/hash.go @@ -18,9 +18,11 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" + + "github.com/smallstep/cli/flags" ) type hashConstructor func() hash.Hash diff --git a/command/crypto/jwe/decrypt.go b/command/crypto/jwe/decrypt.go index 960a29f56..8d11e91c4 100644 --- a/command/crypto/jwe/decrypt.go +++ b/command/crypto/jwe/decrypt.go @@ -4,13 +4,14 @@ import ( "fmt" "os" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "github.com/pkg/errors" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" + + "github.com/smallstep/cli/utils" ) func decryptCommand() cli.Command { diff --git a/command/crypto/jwe/encrypt.go b/command/crypto/jwe/encrypt.go index f0fd7fad4..a5e73beb2 100644 --- a/command/crypto/jwe/encrypt.go +++ b/command/crypto/jwe/encrypt.go @@ -5,12 +5,14 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func encryptCommand() cli.Command { diff --git a/command/crypto/jwk/create.go b/command/crypto/jwk/create.go index 090bbb3b4..122caf724 100644 --- a/command/crypto/jwk/create.go +++ b/command/crypto/jwk/create.go @@ -9,15 +9,17 @@ import ( "strconv" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" "go.step.sm/crypto/keyutil" "go.step.sm/crypto/randutil" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) const ( diff --git a/command/crypto/jwk/keyset.go b/command/crypto/jwk/keyset.go index d45aa22bd..a0e4aa8a6 100644 --- a/command/crypto/jwk/keyset.go +++ b/command/crypto/jwk/keyset.go @@ -8,11 +8,13 @@ import ( "syscall" "github.com/pkg/errors" - "github.com/smallstep/cli/utils/sysutils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" + + "github.com/smallstep/cli/utils/sysutils" ) func keysetCommand() cli.Command { diff --git a/command/crypto/jwk/public.go b/command/crypto/jwk/public.go index a3e61e490..349837ffd 100644 --- a/command/crypto/jwk/public.go +++ b/command/crypto/jwk/public.go @@ -8,7 +8,8 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" ) diff --git a/command/crypto/jwk/thumbprint.go b/command/crypto/jwk/thumbprint.go index 6b1640127..a91661ad8 100644 --- a/command/crypto/jwk/thumbprint.go +++ b/command/crypto/jwk/thumbprint.go @@ -10,7 +10,8 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" ) diff --git a/command/crypto/jws/inspect.go b/command/crypto/jws/inspect.go index 00d6790a6..bae786636 100644 --- a/command/crypto/jws/inspect.go +++ b/command/crypto/jws/inspect.go @@ -8,11 +8,13 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/jose" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func inspectCommand() cli.Command { diff --git a/command/crypto/jws/sign.go b/command/crypto/jws/sign.go index 2f284f58a..b5ae0e552 100644 --- a/command/crypto/jws/sign.go +++ b/command/crypto/jws/sign.go @@ -9,7 +9,8 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/jose" "go.step.sm/crypto/pemutil" ) diff --git a/command/crypto/jws/verify.go b/command/crypto/jws/verify.go index f18a69237..e2c6e1c8f 100644 --- a/command/crypto/jws/verify.go +++ b/command/crypto/jws/verify.go @@ -4,11 +4,13 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/jose" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func verifyCommand() cli.Command { diff --git a/command/crypto/jwt/inspect.go b/command/crypto/jwt/inspect.go index 7d8724cd2..a6f68aac4 100644 --- a/command/crypto/jwt/inspect.go +++ b/command/crypto/jwt/inspect.go @@ -8,10 +8,12 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/jose" + + "github.com/smallstep/cli/utils" ) func inspectCommand() cli.Command { diff --git a/command/crypto/jwt/sign.go b/command/crypto/jwt/sign.go index 9b6a4c4c5..145272a8e 100644 --- a/command/crypto/jwt/sign.go +++ b/command/crypto/jwt/sign.go @@ -10,12 +10,14 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/jose" "go.step.sm/crypto/pemutil" "go.step.sm/crypto/randutil" + + "github.com/smallstep/cli/flags" ) func signCommand() cli.Command { diff --git a/command/crypto/jwt/verify.go b/command/crypto/jwt/verify.go index 60ebc9fa0..3d91ea16c 100644 --- a/command/crypto/jwt/verify.go +++ b/command/crypto/jwt/verify.go @@ -7,11 +7,13 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/jose" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func verifyCommand() cli.Command { diff --git a/command/crypto/kdf/kdf.go b/command/crypto/kdf/kdf.go index 0251cbb26..a6c3c78b2 100644 --- a/command/crypto/kdf/kdf.go +++ b/command/crypto/kdf/kdf.go @@ -4,11 +4,13 @@ import ( "fmt" "github.com/pkg/errors" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/kdf" "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" ) // Command returns the cli.Command for kdf and related subcommands. diff --git a/command/crypto/key/fingerprint.go b/command/crypto/key/fingerprint.go index ea703d1de..e4b234fd7 100644 --- a/command/crypto/key/fingerprint.go +++ b/command/crypto/key/fingerprint.go @@ -13,13 +13,15 @@ import ( _ "crypto/sha1" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/fingerprint" "go.step.sm/crypto/pemutil" "golang.org/x/crypto/ssh" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func fingerprintCommand() cli.Command { diff --git a/command/crypto/key/format.go b/command/crypto/key/format.go index f22a1cd80..2b3f8a3f3 100644 --- a/command/crypto/key/format.go +++ b/command/crypto/key/format.go @@ -11,14 +11,16 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" "go.step.sm/crypto/pemutil" "golang.org/x/crypto/ssh" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func formatCommand() cli.Command { diff --git a/command/crypto/key/inspect.go b/command/crypto/key/inspect.go index 046935556..40f5d1f2d 100644 --- a/command/crypto/key/inspect.go +++ b/command/crypto/key/inspect.go @@ -9,11 +9,13 @@ import ( "math/big" "github.com/pkg/errors" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/utils" ) func inspectCommand() cli.Command { diff --git a/command/crypto/key/public.go b/command/crypto/key/public.go index 670956845..40b6fb227 100644 --- a/command/crypto/key/public.go +++ b/command/crypto/key/public.go @@ -4,14 +4,16 @@ import ( "encoding/pem" "os" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/keyutil" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func publicCommand() cli.Command { diff --git a/command/crypto/key/sign.go b/command/crypto/key/sign.go index 5c976bc4d..10fb39828 100644 --- a/command/crypto/key/sign.go +++ b/command/crypto/key/sign.go @@ -13,11 +13,13 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/utils" ) var hashAlgFlag = cli.StringFlag{ diff --git a/command/crypto/key/verify.go b/command/crypto/key/verify.go index 790e77fa8..a10b6f6ee 100644 --- a/command/crypto/key/verify.go +++ b/command/crypto/key/verify.go @@ -10,11 +10,13 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/utils" ) func verifyCommand() cli.Command { diff --git a/command/crypto/keypair.go b/command/crypto/keypair.go index 3129e24d7..332259f11 100644 --- a/command/crypto/keypair.go +++ b/command/crypto/keypair.go @@ -2,15 +2,17 @@ package crypto import ( "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" "go.step.sm/crypto/keyutil" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func createKeyPairCommand() cli.Command { diff --git a/command/crypto/nacl/auth.go b/command/crypto/nacl/auth.go index 15fdf71d7..41601cd9a 100644 --- a/command/crypto/nacl/auth.go +++ b/command/crypto/nacl/auth.go @@ -6,10 +6,12 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" "golang.org/x/crypto/nacl/auth" + + "github.com/smallstep/cli-utils/errs" + + "github.com/smallstep/cli/utils" ) func authCommand() cli.Command { diff --git a/command/crypto/nacl/box.go b/command/crypto/nacl/box.go index a07bd0d77..10671c741 100644 --- a/command/crypto/nacl/box.go +++ b/command/crypto/nacl/box.go @@ -6,13 +6,15 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" "golang.org/x/crypto/nacl/box" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func boxCommand() cli.Command { diff --git a/command/crypto/nacl/secretbox.go b/command/crypto/nacl/secretbox.go index cb69d04c5..50a9be364 100644 --- a/command/crypto/nacl/secretbox.go +++ b/command/crypto/nacl/secretbox.go @@ -5,10 +5,12 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" "golang.org/x/crypto/nacl/secretbox" + + "github.com/smallstep/cli-utils/errs" + + "github.com/smallstep/cli/utils" ) func secretboxCommand() cli.Command { diff --git a/command/crypto/nacl/sign.go b/command/crypto/nacl/sign.go index ddb1080a8..f48cd6c6a 100644 --- a/command/crypto/nacl/sign.go +++ b/command/crypto/nacl/sign.go @@ -6,13 +6,15 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" "golang.org/x/crypto/nacl/sign" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func signCommand() cli.Command { diff --git a/command/crypto/otp/generate.go b/command/crypto/otp/generate.go index ca53338ab..821597b83 100644 --- a/command/crypto/otp/generate.go +++ b/command/crypto/otp/generate.go @@ -8,11 +8,13 @@ import ( "github.com/pquerna/otp" "github.com/pquerna/otp/totp" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" ) func generateCommand() cli.Command { diff --git a/command/crypto/otp/verify.go b/command/crypto/otp/verify.go index df41ef738..8ddb46470 100644 --- a/command/crypto/otp/verify.go +++ b/command/crypto/otp/verify.go @@ -11,10 +11,12 @@ import ( "github.com/pkg/errors" "github.com/pquerna/otp" "github.com/pquerna/otp/totp" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" ) func verifyCommand() cli.Command { diff --git a/command/crypto/rand/rand.go b/command/crypto/rand/rand.go index de8b9faaa..c115552ba 100644 --- a/command/crypto/rand/rand.go +++ b/command/crypto/rand/rand.go @@ -10,8 +10,10 @@ import ( "strings" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "go.step.sm/crypto/fingerprint" "go.step.sm/crypto/randutil" ) diff --git a/command/crypto/winpe/winpe.go b/command/crypto/winpe/winpe.go index 2da226eb9..2c10ef995 100644 --- a/command/crypto/winpe/winpe.go +++ b/command/crypto/winpe/winpe.go @@ -12,7 +12,8 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" "go.mozilla.org/pkcs7" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" ) // Command returns the winpe subcommand. diff --git a/command/fileserver/fileserver.go b/command/fileserver/fileserver.go index 76f18288c..70ff2c5bf 100644 --- a/command/fileserver/fileserver.go +++ b/command/fileserver/fileserver.go @@ -16,11 +16,12 @@ import ( "syscall" "time" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + + "github.com/smallstep/cli/utils" ) func init() { diff --git a/command/oauth/cmd.go b/command/oauth/cmd.go index b1ad53385..5651b27a7 100644 --- a/command/oauth/cmd.go +++ b/command/oauth/cmd.go @@ -20,14 +20,16 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/exec" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/jose" "go.step.sm/crypto/randutil" + + "github.com/smallstep/cli/exec" + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) // 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 5a9b25d90..47442bfc5 100644 --- a/command/path/path.go +++ b/command/path/path.go @@ -4,8 +4,9 @@ import ( "fmt" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/step" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/step" ) func init() { diff --git a/command/ssh/certificate.go b/command/ssh/certificate.go index 973779e71..3e67dfb05 100644 --- a/command/ssh/certificate.go +++ b/command/ssh/certificate.go @@ -11,22 +11,24 @@ import ( "github.com/google/uuid" "github.com/pkg/errors" + "github.com/urfave/cli" + "golang.org/x/crypto/blake2b" + "golang.org/x/crypto/ssh" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/ca/identity" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/keyutil" + "go.step.sm/crypto/pemutil" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/sshutil" "github.com/smallstep/cli/utils" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/keyutil" - "go.step.sm/crypto/pemutil" - "golang.org/x/crypto/blake2b" - "golang.org/x/crypto/ssh" ) func certificateCommand() cli.Command { diff --git a/command/ssh/checkHost.go b/command/ssh/checkHost.go index 0d9d6b4aa..7a7ad45d7 100644 --- a/command/ssh/checkHost.go +++ b/command/ssh/checkHost.go @@ -7,15 +7,17 @@ import ( "time" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/ca" caErrs "github.com/smallstep/certificates/errs" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "go.step.sm/crypto/jose" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/token" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/crypto/jose" ) func checkHostCommand() cli.Command { diff --git a/command/ssh/config.go b/command/ssh/config.go index 25c587f8e..451cd2efe 100644 --- a/command/ssh/config.go +++ b/command/ssh/config.go @@ -8,19 +8,21 @@ import ( "strings" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/templates" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" + "golang.org/x/crypto/ssh" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/sshutil" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" - "golang.org/x/crypto/ssh" ) func configCommand() cli.Command { diff --git a/command/ssh/fingerprint.go b/command/ssh/fingerprint.go index 477a20353..96a7e11cd 100644 --- a/command/ssh/fingerprint.go +++ b/command/ssh/fingerprint.go @@ -3,11 +3,13 @@ package ssh import ( "fmt" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/sshutil" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/utils" ) func fingerPrintCommand() cli.Command { diff --git a/command/ssh/hosts.go b/command/ssh/hosts.go index a0ded0212..7440cfcbc 100644 --- a/command/ssh/hosts.go +++ b/command/ssh/hosts.go @@ -5,12 +5,14 @@ import ( "os" "text/tabwriter" + "github.com/urfave/cli" + "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" ) func hostsCommand() cli.Command { diff --git a/command/ssh/inspect.go b/command/ssh/inspect.go index 75743395e..6391e700e 100644 --- a/command/ssh/inspect.go +++ b/command/ssh/inspect.go @@ -8,12 +8,14 @@ import ( "os" "github.com/pkg/errors" - "github.com/smallstep/cli/internal/sshutil" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" "golang.org/x/crypto/ssh" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + + "github.com/smallstep/cli/internal/sshutil" + "github.com/smallstep/cli/utils" ) func inspectCommand() cli.Command { diff --git a/command/ssh/list.go b/command/ssh/list.go index dc1df3ee6..3067a747a 100644 --- a/command/ssh/list.go +++ b/command/ssh/list.go @@ -4,11 +4,14 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/smallstep/cli/internal/sshutil" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + libsshutil "go.step.sm/crypto/sshutil" + + "github.com/smallstep/cli/internal/sshutil" ) func listCommand() cli.Command { diff --git a/command/ssh/login.go b/command/ssh/login.go index 01674440b..8eda7acdf 100644 --- a/command/ssh/login.go +++ b/command/ssh/login.go @@ -5,19 +5,21 @@ import ( "time" "github.com/pkg/errors" + "github.com/urfave/cli" + "golang.org/x/crypto/ssh" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/keyutil" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/sshutil" "github.com/smallstep/cli/utils" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/keyutil" - "golang.org/x/crypto/ssh" ) func loginCommand() cli.Command { diff --git a/command/ssh/logout.go b/command/ssh/logout.go index a7054b61b..1726fc40f 100644 --- a/command/ssh/logout.go +++ b/command/ssh/logout.go @@ -4,13 +4,15 @@ import ( "fmt" "github.com/pkg/errors" + "github.com/urfave/cli" + "golang.org/x/crypto/ssh" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/sshutil" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "golang.org/x/crypto/ssh" ) func logoutCommand() cli.Command { diff --git a/command/ssh/needsRenewal.go b/command/ssh/needsRenewal.go index f53b5e41d..4145e9ab0 100644 --- a/command/ssh/needsRenewal.go +++ b/command/ssh/needsRenewal.go @@ -8,11 +8,13 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/cli/internal/sshutil" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" "golang.org/x/crypto/ssh" + + "github.com/smallstep/cli-utils/errs" + + "github.com/smallstep/cli/internal/sshutil" + "github.com/smallstep/cli/utils" ) const defaultPercentUsedThreshold = 66 diff --git a/command/ssh/proxycommand.go b/command/ssh/proxycommand.go index 159ed1780..fe35cf187 100644 --- a/command/ssh/proxycommand.go +++ b/command/ssh/proxycommand.go @@ -10,18 +10,20 @@ import ( "time" "github.com/pkg/errors" + "github.com/urfave/cli" + "golang.org/x/crypto/ssh" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "go.step.sm/crypto/keyutil" + "github.com/smallstep/cli/exec" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/sshutil" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/crypto/keyutil" - "golang.org/x/crypto/ssh" ) const sshDefaultPath = "/usr/bin/ssh" diff --git a/command/ssh/rekey.go b/command/ssh/rekey.go index d8ed92778..e9278cc26 100644 --- a/command/ssh/rekey.go +++ b/command/ssh/rekey.go @@ -5,19 +5,22 @@ import ( "strconv" "github.com/pkg/errors" + "github.com/urfave/cli" + "golang.org/x/crypto/ssh" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca/identity" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + + "go.step.sm/crypto/keyutil" + "go.step.sm/crypto/pemutil" + "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" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/keyutil" - "go.step.sm/crypto/pemutil" - "golang.org/x/crypto/ssh" ) func rekeyCommand() cli.Command { diff --git a/command/ssh/renew.go b/command/ssh/renew.go index 36c95feb4..5d77e1682 100644 --- a/command/ssh/renew.go +++ b/command/ssh/renew.go @@ -4,19 +4,20 @@ import ( "os" "strconv" - "github.com/smallstep/certificates/ca/identity" - "github.com/pkg/errors" + "github.com/urfave/cli" + "golang.org/x/crypto/ssh" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" + "github.com/smallstep/certificates/ca/identity" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "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" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "golang.org/x/crypto/ssh" ) func renewCommand() cli.Command { diff --git a/command/ssh/revoke.go b/command/ssh/revoke.go index 251d285eb..5944abb2a 100644 --- a/command/ssh/revoke.go +++ b/command/ssh/revoke.go @@ -5,17 +5,19 @@ import ( "strconv" "github.com/pkg/errors" + "github.com/urfave/cli" + "golang.org/x/crypto/ssh" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + cmdca "github.com/smallstep/cli/command/ca" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "golang.org/x/crypto/ssh" ) func revokeCommand() cli.Command { diff --git a/command/ssh/ssh.go b/command/ssh/ssh.go index 3fcadb47c..45ef90f0d 100644 --- a/command/ssh/ssh.go +++ b/command/ssh/ssh.go @@ -5,19 +5,21 @@ import ( "strings" "github.com/pkg/errors" + "github.com/urfave/cli" + "golang.org/x/crypto/ssh" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/errs" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/keyutil" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/sshutil" "github.com/smallstep/cli/token" "github.com/smallstep/cli/utils/cautils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/keyutil" - "golang.org/x/crypto/ssh" ) // init creates and registers the ssh command diff --git a/command/version/version.go b/command/version/version.go index 39d9c01f5..11874ad3a 100644 --- a/command/version/version.go +++ b/command/version/version.go @@ -3,11 +3,12 @@ package version import ( "fmt" - "github.com/smallstep/cli/flags" "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/step" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/step" + + "github.com/smallstep/cli/flags" ) func init() { diff --git a/flags/flags.go b/flags/flags.go index a344d0a8d..6275b191d 100644 --- a/flags/flags.go +++ b/flags/flags.go @@ -10,12 +10,14 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/certificates/api" - "github.com/smallstep/cli/utils" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/step" + + "github.com/smallstep/certificates/api" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/step" "go.step.sm/crypto/fingerprint" + + "github.com/smallstep/cli/utils" ) var ( diff --git a/go.mod b/go.mod index a116ab6a0..76e9cf117 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 github.com/smallstep/certificates v0.27.4 github.com/smallstep/certinfo v1.12.2 + github.com/smallstep/cli-utils v0.10.0 github.com/smallstep/go-attestation v0.4.4-0.20240109183208-413678f90935 github.com/smallstep/truststore v0.13.0 github.com/smallstep/zcrypto v0.0.0-20221001003018-1ab2364d2a91 diff --git a/go.sum b/go.sum index d80610532..735b68646 100644 --- a/go.sum +++ b/go.sum @@ -328,6 +328,8 @@ github.com/smallstep/certificates v0.27.4 h1:U/md0T1clj88SUL9d2i0DthOGvEzTULbqVR github.com/smallstep/certificates v0.27.4/go.mod h1:VEZuWd4KTmdSUpkwjeB42u/T4Z8D0blzbZpvDDd+WME= github.com/smallstep/certinfo v1.12.2 h1:cuyiPNo86yekliQduAGP/5BDR4JA/8S1UCtDtpKl8fQ= github.com/smallstep/certinfo v1.12.2/go.mod h1:J8E+AF8ZPEaCqG+eM3gAKGGfo7Zb9DSghjf9VG96x/0= +github.com/smallstep/cli-utils v0.10.0 h1:CfXNvHtIN5pAzGvGP0NEUZoGFcj5epNEB6RSpSfduek= +github.com/smallstep/cli-utils v0.10.0/go.mod h1:jIeNa5ctrVg89lU5TaQKYd6o1eFxi9mtZu1sXSxpEBg= github.com/smallstep/go-attestation v0.4.4-0.20240109183208-413678f90935 h1:kjYvkvS/Wdy0PVRDUAA0gGJIVSEZYhiAJtfwYgOYoGA= github.com/smallstep/go-attestation v0.4.4-0.20240109183208-413678f90935/go.mod h1:vNAduivU014fubg6ewygkAvQC0IQVXqdc8vaGl/0er4= github.com/smallstep/nosql v0.7.0 h1:YiWC9ZAHcrLCrayfaF+QJUv16I2bZ7KdLC3RpJcnAnE= diff --git a/integration/help_quality_test.go b/integration/help_quality_test.go index ca577ae9f..c30173872 100644 --- a/integration/help_quality_test.go +++ b/integration/help_quality_test.go @@ -12,7 +12,7 @@ import ( "testing" "github.com/smallstep/assert" - "go.step.sm/cli-utils/usage" + "github.com/smallstep/cli-utils/usage" ) func TestHelpQuality(t *testing.T) { diff --git a/internal/plugin/plugin.go b/internal/plugin/plugin.go index 4bd9e2d69..006105253 100644 --- a/internal/plugin/plugin.go +++ b/internal/plugin/plugin.go @@ -8,7 +8,8 @@ import ( "strings" "github.com/urfave/cli" - "go.step.sm/cli-utils/step" + + "github.com/smallstep/cli-utils/step" ) // LookPath searches for an executable named step--plugin in the $(step diff --git a/internal/sshutil/shell.go b/internal/sshutil/shell.go index 0d4966737..81e925a5d 100644 --- a/internal/sshutil/shell.go +++ b/internal/sshutil/shell.go @@ -9,10 +9,11 @@ import ( "strings" "github.com/pkg/errors" - "go.step.sm/cli-utils/step" "golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh/knownhosts" "golang.org/x/term" + + "github.com/smallstep/cli-utils/step" ) // ProxyCommand replaces %%, %h, %p, and %r in the given command. diff --git a/utils/cautils/acme_flow.go b/utils/cautils/acme_flow.go index 318c2f420..1549a4965 100644 --- a/utils/cautils/acme_flow.go +++ b/utils/cautils/acme_flow.go @@ -5,7 +5,8 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "go.step.sm/cli-utils/ui" + + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/pemutil" ) diff --git a/utils/cautils/acmeutils.go b/utils/cautils/acmeutils.go index c7e1bc602..66025d307 100644 --- a/utils/cautils/acmeutils.go +++ b/utils/cautils/acmeutils.go @@ -26,18 +26,18 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/certificates/acme" + acmeAPI "github.com/smallstep/certificates/acme/api" + "github.com/smallstep/certificates/ca" + "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" "go.step.sm/crypto/keyutil" "go.step.sm/crypto/pemutil" "go.step.sm/crypto/tpm" tpmstorage "go.step.sm/crypto/tpm/storage" - "github.com/smallstep/certificates/acme" - acmeAPI "github.com/smallstep/certificates/acme/api" - "github.com/smallstep/certificates/ca" - "github.com/smallstep/certificates/pki" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/internal/cryptoutil" "github.com/smallstep/cli/utils" diff --git a/utils/cautils/bootstrap.go b/utils/cautils/bootstrap.go index 1bf33bc22..fd375425f 100644 --- a/utils/cautils/bootstrap.go +++ b/utils/cautils/bootstrap.go @@ -11,15 +11,17 @@ import ( "strings" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/utils" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" "github.com/smallstep/truststore" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/utils" ) type bootstrapAPIResponse struct { diff --git a/utils/cautils/certificate_flow.go b/utils/cautils/certificate_flow.go index 8199e2edc..8403ef8ee 100644 --- a/utils/cautils/certificate_flow.go +++ b/utils/cautils/certificate_flow.go @@ -14,20 +14,22 @@ import ( "time" "github.com/pkg/errors" + "github.com/urfave/cli" + "golang.org/x/crypto/ssh" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/flags" - "github.com/smallstep/cli/token" - "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/keyutil" "go.step.sm/crypto/pemutil" "go.step.sm/crypto/x509util" - "golang.org/x/crypto/ssh" + + "github.com/smallstep/cli/flags" + "github.com/smallstep/cli/token" + "github.com/smallstep/cli/utils" ) // CertificateFlow manages the flow to retrieve a new certificate. diff --git a/utils/cautils/client.go b/utils/cautils/client.go index 8569e8e1c..ab66c9f76 100644 --- a/utils/cautils/client.go +++ b/utils/cautils/client.go @@ -9,16 +9,19 @@ import ( "time" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/pki" - "github.com/smallstep/cli/flags" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/keyutil" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli/flags" ) // CaClient is the interface implemented by a client used to sign, renew, revoke diff --git a/utils/cautils/token_flow.go b/utils/cautils/token_flow.go index 185d91538..7e02e8c28 100644 --- a/utils/cautils/token_flow.go +++ b/utils/cautils/token_flow.go @@ -7,13 +7,15 @@ import ( "time" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" ) type provisionersSelect struct { diff --git a/utils/cautils/token_generator.go b/utils/cautils/token_generator.go index 71d1b3853..8aaaef314 100644 --- a/utils/cautils/token_generator.go +++ b/utils/cautils/token_generator.go @@ -14,18 +14,20 @@ import ( "time" "github.com/pkg/errors" + "github.com/urfave/cli" + "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/pki" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/jose" + "go.step.sm/crypto/pemutil" + "go.step.sm/crypto/randutil" + "github.com/smallstep/cli/exec" "github.com/smallstep/cli/internal/cryptoutil" "github.com/smallstep/cli/token" "github.com/smallstep/cli/token/provision" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/jose" - "go.step.sm/crypto/pemutil" - "go.step.sm/crypto/randutil" ) // TokenGenerator is a helper used to generate different types of tokens used in diff --git a/utils/cautils/tpm.go b/utils/cautils/tpm.go index 49535c762..d44336ccb 100644 --- a/utils/cautils/tpm.go +++ b/utils/cautils/tpm.go @@ -26,14 +26,15 @@ import ( "github.com/smallstep/certificates/acme" "github.com/smallstep/certificates/ca" - "github.com/smallstep/cli/utils" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" "go.step.sm/crypto/keyutil" "go.step.sm/crypto/kms/uri" "go.step.sm/crypto/tpm" tpmstorage "go.step.sm/crypto/tpm/storage" + + "github.com/smallstep/cli/utils" ) func doTPMAttestation(clictx *cli.Context, ac *ca.ACMEClient, ch *acme.Challenge, identifier string, af *acmeFlow) error { diff --git a/utils/cli.go b/utils/cli.go index 3461da364..26966562a 100644 --- a/utils/cli.go +++ b/utils/cli.go @@ -4,7 +4,8 @@ import ( "strconv" "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" + + "github.com/smallstep/cli-utils/errs" "go.step.sm/crypto/keyutil" ) diff --git a/utils/file.go b/utils/file.go index b329faa0b..90581ebac 100644 --- a/utils/file.go +++ b/utils/file.go @@ -3,7 +3,7 @@ package utils import ( "os" - "go.step.sm/cli-utils/errs" + "github.com/smallstep/cli-utils/errs" ) // File represents a wrapper on os.File that supports read, write, seek and diff --git a/utils/read.go b/utils/read.go index 869c7a2cb..ca4675deb 100644 --- a/utils/read.go +++ b/utils/read.go @@ -9,10 +9,11 @@ import ( "unicode" "github.com/pkg/errors" - "github.com/smallstep/cli/utils/internal/utfbom" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" + + "github.com/smallstep/cli/utils/internal/utfbom" ) // In command line utilities, it is a de facto standard that a hyphen "-" diff --git a/utils/write.go b/utils/write.go index 564eecb0f..c18b4b4de 100644 --- a/utils/write.go +++ b/utils/write.go @@ -11,9 +11,9 @@ import ( "github.com/pkg/errors" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/ui" ) var ( From 177f391fb77bfcf87cfd2fc581a62dd425c07145 Mon Sep 17 00:00:00 2001 From: Herman Slatman Date: Mon, 30 Sep 2024 12:45:46 +0200 Subject: [PATCH 2/3] Use `github.com/smallstep/cli-utils` in CLI `main` --- cmd/step/main.go | 26 ++++++++++++++------------ go.mod | 4 ++-- go.sum | 48 ++++++++++++++++++++++++------------------------ 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/cmd/step/main.go b/cmd/step/main.go index eae9ea020..fbada2e5b 100644 --- a/cmd/step/main.go +++ b/cmd/step/main.go @@ -9,17 +9,24 @@ import ( "strings" "time" + "github.com/urfave/cli" + "github.com/smallstep/certificates/ca" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/jose" + "go.step.sm/crypto/pemutil" + + "github.com/smallstep/cli-utils/usage" "github.com/smallstep/cli/command/version" "github.com/smallstep/cli/internal/plugin" "github.com/smallstep/cli/utils" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" - "go.step.sm/cli-utils/usage" - "go.step.sm/crypto/jose" - "go.step.sm/crypto/pemutil" + + // Enabled cas interfaces. + _ "github.com/smallstep/certificates/cas/cloudcas" + _ "github.com/smallstep/certificates/cas/softcas" + _ "github.com/smallstep/certificates/cas/stepcas" // Enabled commands _ "github.com/smallstep/cli/command/api" @@ -35,11 +42,6 @@ import ( _ "github.com/smallstep/cli/command/oauth" _ "github.com/smallstep/cli/command/path" _ "github.com/smallstep/cli/command/ssh" - - // Enabled cas interfaces. - _ "github.com/smallstep/certificates/cas/cloudcas" - _ "github.com/smallstep/certificates/cas/softcas" - _ "github.com/smallstep/certificates/cas/stepcas" ) // Version is set by an LDFLAG at build time representing the git tag or commit diff --git a/go.mod b/go.mod index 76e9cf117..0779550bf 100644 --- a/go.mod +++ b/go.mod @@ -26,8 +26,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/urfave/cli v1.22.15 go.mozilla.org/pkcs7 v0.9.0 - go.step.sm/cli-utils v0.9.0 - go.step.sm/crypto v0.52.0 + go.step.sm/crypto v0.51.2 go.step.sm/linkedca v0.22.1 golang.org/x/crypto v0.27.0 golang.org/x/sys v0.25.0 @@ -135,6 +134,7 @@ require ( go.opentelemetry.io/otel v1.29.0 // indirect go.opentelemetry.io/otel/metric v1.29.0 // indirect go.opentelemetry.io/otel/trace v1.29.0 // indirect + go.step.sm/cli-utils v0.9.0 // indirect golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.22.0 // indirect diff --git a/go.sum b/go.sum index 735b68646..880cce932 100644 --- a/go.sum +++ b/go.sum @@ -50,32 +50,32 @@ github.com/ThomasRooney/gexpect v0.0.0-20161231170123-5482f0350944/go.mod h1:sPM github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go-v2 v1.30.5 h1:mWSRTwQAb0aLE17dSzztCVJWI9+cRMgqebndjwDyK0g= -github.com/aws/aws-sdk-go-v2 v1.30.5/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0= -github.com/aws/aws-sdk-go-v2/config v1.27.33 h1:Nof9o/MsmH4oa0s2q9a0k7tMz5x/Yj5k06lDODWz3BU= -github.com/aws/aws-sdk-go-v2/config v1.27.33/go.mod h1:kEqdYzRb8dd8Sy2pOdEbExTTF5v7ozEXX0McgPE7xks= -github.com/aws/aws-sdk-go-v2/credentials v1.17.32 h1:7Cxhp/BnT2RcGy4VisJ9miUPecY+lyE9I8JvcZofn9I= -github.com/aws/aws-sdk-go-v2/credentials v1.17.32/go.mod h1:P5/QMF3/DCHbXGEGkdbilXHsyTBX5D3HSwcrSc9p20I= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13 h1:pfQ2sqNpMVK6xz2RbqLEL0GH87JOwSxPV2rzm8Zsb74= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13/go.mod h1:NG7RXPUlqfsCLLFfi0+IpKN4sCB9D9fw/qTaSB+xRoU= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 h1:pI7Bzt0BJtYA0N/JEC6B8fJ4RBrEMi1LBrkMdFYNSnQ= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17/go.mod h1:Dh5zzJYMtxfIjYW+/evjQ8uj2OyR/ve2KROHGHlSFqE= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 h1:Mqr/V5gvrhA2gvgnF42Zh5iMiQNcOYthFYwCyrnuWlc= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17/go.mod h1:aLJpZlCmjE+V+KtN1q1uyZkfnUWpQGpbsn89XPKyzfU= +github.com/aws/aws-sdk-go-v2 v1.30.4 h1:frhcagrVNrzmT95RJImMHgabt99vkXGslubDaDagTk8= +github.com/aws/aws-sdk-go-v2 v1.30.4/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0= +github.com/aws/aws-sdk-go-v2/config v1.27.31 h1:kxBoRsjhT3pq0cKthgj6RU6bXTm/2SgdoUMyrVw0rAI= +github.com/aws/aws-sdk-go-v2/config v1.27.31/go.mod h1:z04nZdSWFPaDwK3DdJOG2r+scLQzMYuJeW0CujEm9FM= +github.com/aws/aws-sdk-go-v2/credentials v1.17.30 h1:aau/oYFtibVovr2rDt8FHlU17BTicFEMAi29V1U+L5Q= +github.com/aws/aws-sdk-go-v2/credentials v1.17.30/go.mod h1:BPJ/yXV92ZVq6G8uYvbU0gSl8q94UB63nMT5ctNO38g= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 h1:yjwoSyDZF8Jth+mUk5lSPJCkMC0lMy6FaCD51jm6ayE= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12/go.mod h1:fuR57fAgMk7ot3WcNQfb6rSEn+SUffl7ri+aa8uKysI= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 h1:TNyt/+X43KJ9IJJMjKfa3bNTiZbUP7DeCxfbTROESwY= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16/go.mod h1:2DwJF39FlNAUiX5pAc0UNeiz16lK2t7IaFcm0LFHEgc= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 h1:jYfy8UPmd+6kJW5YhY0L1/KftReOGxI/4NtVSTh9O/I= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16/go.mod h1:7ZfEPZxkW42Afq4uQB8H2E2e6ebh6mXTueEpYzjCzcs= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 h1:KypMCbLPPHEmf9DgMGw51jMj77VfGPAN2Kv4cfhlfgI= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4/go.mod h1:Vz1JQXliGcQktFTN/LN6uGppAIRoLBR2bMvIMP0gOjc= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19 h1:rfprUlsdzgl7ZL2KlXiUAoJnI/VxfHCvDFr2QDFj6u4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19/go.mod h1:SCWkEdRq8/7EK60NcvvQ6NXKuTcchAD4ROAsC37VEZE= -github.com/aws/aws-sdk-go-v2/service/kms v1.35.7 h1:v0D1LeMkA/X+JHAZWERrr+sUGOt8KrCZKnJA6KszkcE= -github.com/aws/aws-sdk-go-v2/service/kms v1.35.7/go.mod h1:K9lwD0Rsx9+NSaJKsdAdlDK4b2G4KKOEve9PzHxPoMI= -github.com/aws/aws-sdk-go-v2/service/sso v1.22.7 h1:pIaGg+08llrP7Q5aiz9ICWbY8cqhTkyy+0SHvfzQpTc= -github.com/aws/aws-sdk-go-v2/service/sso v1.22.7/go.mod h1:eEygMHnTKH/3kNp9Jr1n3PdejuSNcgwLe1dWgQtO0VQ= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.7 h1:/Cfdu0XV3mONYKaOt1Gr0k1KvQzkzPyiKUdlWJqy+J4= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.7/go.mod h1:bCbAxKDqNvkHxRaIMnyVPXPo+OaPRwvmgzMxbz1VKSA= -github.com/aws/aws-sdk-go-v2/service/sts v1.30.7 h1:NKTa1eqZYw8tiHSRGpP0VtTdub/8KNk8sDkNPFaOKDE= -github.com/aws/aws-sdk-go-v2/service/sts v1.30.7/go.mod h1:NXi1dIAGteSaRLqYgarlhP/Ij0cFT+qmCwiJqWh/U5o= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18 h1:tJ5RnkHCiSH0jyd6gROjlJtNwov0eGYNz8s8nFcR0jQ= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18/go.mod h1:++NHzT+nAF7ZPrHPsA+ENvsXkOO8wEu+C6RXltAG4/c= +github.com/aws/aws-sdk-go-v2/service/kms v1.35.5 h1:XUomV7SiclZl1QuXORdGcfFqHxEHET7rmNGtxTfNB+M= +github.com/aws/aws-sdk-go-v2/service/kms v1.35.5/go.mod h1:A5CS0VRmxxj2YKYLCY08l/Zzbd01m6JZn0WzxgT1OCA= +github.com/aws/aws-sdk-go-v2/service/sso v1.22.5 h1:zCsFCKvbj25i7p1u94imVoO447I/sFv8qq+lGJhRN0c= +github.com/aws/aws-sdk-go-v2/service/sso v1.22.5/go.mod h1:ZeDX1SnKsVlejeuz41GiajjZpRSWR7/42q/EyA/QEiM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5 h1:SKvPgvdvmiTWoi0GAJ7AsJfOz3ngVkD/ERbs5pUnHNI= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5/go.mod h1:20sz31hv/WsPa3HhU3hfrIet2kxM4Pe0r20eBZ20Tac= +github.com/aws/aws-sdk-go-v2/service/sts v1.30.5 h1:OMsEmCyz2i89XwRwPouAJvhj81wINh+4UK+k/0Yo/q8= +github.com/aws/aws-sdk-go-v2/service/sts v1.30.5/go.mod h1:vmSqFK+BVIwVpDAGZB3CoCXHzurt4qBE8lf+I/kRTh0= github.com/aws/smithy-go v1.20.4 h1:2HK1zBdPgRbjFOHlfeQZfpC4r72MOb9bZkiFwggKO+4= github.com/aws/smithy-go v1.20.4/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -398,8 +398,8 @@ go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt3 go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= go.step.sm/cli-utils v0.9.0 h1:55jYcsQbnArNqepZyAwcato6Zy2MoZDRkWW+jF+aPfQ= go.step.sm/cli-utils v0.9.0/go.mod h1:Y/CRoWl1FVR9j+7PnAewufAwKmBOTzR6l9+7EYGAnp8= -go.step.sm/crypto v0.52.0 h1:3blUzFm0S4tPrijcvcP47tvd7VmEEGJnvzblE+sg5LI= -go.step.sm/crypto v0.52.0/go.mod h1:GcT4hMILsNiiN3dIXH/Df5fLVs/KIwGZva85faw7lYw= +go.step.sm/crypto v0.51.2 h1:5EiCGIMg7IvQTGmJrwRosbXeprtT80OhoS/PJarg60o= +go.step.sm/crypto v0.51.2/go.mod h1:QK7czLjN2k+uqVp5CHXxJbhc70kVRSP+0CQF3zsR5M0= go.step.sm/linkedca v0.22.1 h1:GvprpH9P4Sv9U+eZ3bxDgRSSpW14cFDYpe1kS6yWLkw= go.step.sm/linkedca v0.22.1/go.mod h1:dOKdF4HSn73YUEkfS5/FECngZmBtj2Il5DTKWXY4S6Y= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= From 24f94b03a47a8276231ab2b48651e63edfe3873c Mon Sep 17 00:00:00 2001 From: Herman Slatman Date: Mon, 30 Sep 2024 13:24:18 +0200 Subject: [PATCH 3/3] Add basic tests for CLI app initialization and execution --- cmd/step/main.go | 74 ++++++++++++++++++++++++------------------- cmd/step/main_test.go | 46 +++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 33 deletions(-) create mode 100644 cmd/step/main_test.go diff --git a/cmd/step/main.go b/cmd/step/main.go index fbada2e5b..82777390e 100644 --- a/cmd/step/main.go +++ b/cmd/step/main.go @@ -3,6 +3,7 @@ package main import ( "errors" "fmt" + "io" "os" "reflect" "regexp" @@ -15,10 +16,10 @@ import ( "github.com/smallstep/cli-utils/command" "github.com/smallstep/cli-utils/step" "github.com/smallstep/cli-utils/ui" + "github.com/smallstep/cli-utils/usage" "go.step.sm/crypto/jose" "go.step.sm/crypto/pemutil" - "github.com/smallstep/cli-utils/usage" "github.com/smallstep/cli/command/version" "github.com/smallstep/cli/internal/plugin" "github.com/smallstep/cli/utils" @@ -66,6 +67,42 @@ func main() { defer panicHandler() + // create new instance of app + app := newApp(os.Stdout, os.Stderr) + + if err := app.Run(os.Args); err != nil { + var messenger interface { + Message() string + } + if errors.As(err, &messenger) { + if os.Getenv("STEPDEBUG") == "1" { + fmt.Fprintf(os.Stderr, "%+v\n\n%s", err, messenger.Message()) + } else { + fmt.Fprintln(os.Stderr, messenger.Message()) + fmt.Fprintln(os.Stderr, "Re-run with STEPDEBUG=1 for more info.") + } + } else { + if os.Getenv("STEPDEBUG") == "1" { + fmt.Fprintf(os.Stderr, "%+v\n", err) + } else { + fmt.Fprintln(os.Stderr, err) + } + } + //nolint:gocritic // ignore exitAfterDefer error because the defer is required for recovery. + os.Exit(1) + } +} + +func newApp(stdout, stderr io.Writer) *cli.App { + // Define default file writers and prompters for go.step.sm/crypto + pemutil.WriteFile = utils.WriteFile + pemutil.PromptPassword = func(msg string) ([]byte, error) { + return ui.PromptPassword(msg) + } + jose.PromptPassword = func(msg string) ([]byte, error) { + return ui.PromptPassword(msg) + } + // Override global framework components cli.VersionPrinter = func(c *cli.Context) { version.Command(c) @@ -111,39 +148,10 @@ func main() { } // All non-successful output should be written to stderr - app.Writer = os.Stdout - app.ErrWriter = os.Stderr - - // Define default file writers and prompters for go.step.sm/crypto - pemutil.WriteFile = utils.WriteFile - pemutil.PromptPassword = func(msg string) ([]byte, error) { - return ui.PromptPassword(msg) - } - jose.PromptPassword = func(msg string) ([]byte, error) { - return ui.PromptPassword(msg) - } + app.Writer = stdout + app.ErrWriter = stderr - if err := app.Run(os.Args); err != nil { - var messenger interface { - Message() string - } - if errors.As(err, &messenger) { - if os.Getenv("STEPDEBUG") == "1" { - fmt.Fprintf(os.Stderr, "%+v\n\n%s", err, messenger.Message()) - } else { - fmt.Fprintln(os.Stderr, messenger.Message()) - fmt.Fprintln(os.Stderr, "Re-run with STEPDEBUG=1 for more info.") - } - } else { - if os.Getenv("STEPDEBUG") == "1" { - fmt.Fprintf(os.Stderr, "%+v\n", err) - } else { - fmt.Fprintln(os.Stderr, err) - } - } - //nolint:gocritic // ignore exitAfterDefer error because the defer is required for recovery. - os.Exit(1) - } + return app } func panicHandler() { diff --git a/cmd/step/main_test.go b/cmd/step/main_test.go new file mode 100644 index 000000000..82979e39d --- /dev/null +++ b/cmd/step/main_test.go @@ -0,0 +1,46 @@ +package main + +import ( + "bytes" + "regexp" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestAppHasAllCommands(t *testing.T) { + app := newApp(&bytes.Buffer{}, &bytes.Buffer{}) + require.NotNil(t, app) + + require.Equal(t, "step", app.Name) + require.Equal(t, "step", app.HelpName) + + var names = make([]string, 0, len(app.Commands)) + for _, c := range app.Commands { + names = append(names, c.Name) + } + require.Equal(t, []string{ + "help", "api", "path", "base64", "fileserver", + "certificate", "completion", "context", "crl", + "crypto", "oauth", "version", "ca", "beta", "ssh", + }, names) +} + +const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))" + +var ansiRegex = regexp.MustCompile(ansi) + +func TestAppRuns(t *testing.T) { + stdout := &bytes.Buffer{} + stderr := &bytes.Buffer{} + + app := newApp(stdout, stderr) + require.NotNil(t, app) + + err := app.Run([]string{"step"}) + require.NoError(t, err) + require.Empty(t, stderr.Bytes()) + + output := ansiRegex.ReplaceAllString(stdout.String(), "") + require.Contains(t, output, "step -- plumbing for distributed systems") +}