diff --git a/trust/audit.go b/trust/audit.go index 3355258..8609c0d 100644 --- a/trust/audit.go +++ b/trust/audit.go @@ -15,11 +15,11 @@ import ( var CmdTrustAudit = cli.NewCmd[Audit](CmdTrust, "audit", func(cmd *cobra.Command) { cfg := cli.ConfigFromCmd(cmd) - cmd.Flags().StringVarP(&cfg.Trust.Org, "organization", "o", "", "Organization to trust.") + cmd.Flags().StringVarP(&cfg.Trust.Org, "org", "o", "", "Organization to trust.") cmd.Flags().StringVarP(&cfg.Trust.Realm, "realm", "r", "", "Realm to trust.") cmd.Flags().StringSliceVar(&cfg.Trust.Stores, "trust-stores", []string{"homebrew", "nss", "system"}, "Trust stores to update.") - cmd.MarkFlagsRequiredTogether("organization", "realm") + cmd.MarkFlagsRequiredTogether("org", "realm") }) type Audit struct{} diff --git a/trust/audit_test.go b/trust/audit_test.go index dedb860..afa4103 100644 --- a/trust/audit_test.go +++ b/trust/audit_test.go @@ -21,14 +21,14 @@ func TestCmdTrustAudit(t *testing.T) { cmdtest.TestHelp(t, CmdTrustAudit, "trust", "audit", "--help") }) - t.Run("--organization testOrg", func(t *testing.T) { - err := cmdtest.TestError(t, CmdTrustAudit, "--organization", "testOrg") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [realm]") + t.Run("--org testOrg", func(t *testing.T) { + err := cmdtest.TestError(t, CmdTrustAudit, "--org", "testOrg") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [realm]") }) t.Run("-o testOrg", func(t *testing.T) { err := cmdtest.TestError(t, CmdTrustAudit, "-o", "testOrg") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [realm]") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [realm]") }) t.Run("-o testOrg -r testRealm", func(t *testing.T) { @@ -39,12 +39,12 @@ func TestCmdTrustAudit(t *testing.T) { t.Run("--realm testRealm", func(t *testing.T) { err := cmdtest.TestError(t, CmdTrustAudit, "--realm", "testRealm") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [organization]") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [org]") }) t.Run("-r testRealm", func(t *testing.T) { err := cmdtest.TestError(t, CmdTrustAudit, "-r", "testRealm") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [organization]") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [org]") }) t.Run("default --trust-stores", func(t *testing.T) { diff --git a/trust/clean.go b/trust/clean.go index 1df2fc9..8e878a4 100644 --- a/trust/clean.go +++ b/trust/clean.go @@ -17,12 +17,12 @@ var CmdTrustClean = cli.NewCmd[Clean](CmdTrust, "clean", func(cmd *cobra.Command cfg := cli.ConfigFromCmd(cmd) cmd.Flags().StringSliceVar(&cfg.Trust.Clean.States, "cert-states", []string{"expired"}, "Cert states to clean.") - cmd.Flags().StringVarP(&cfg.Trust.Org, "organization", "o", "", "Organization to trust.") + cmd.Flags().StringVarP(&cfg.Trust.Org, "org", "o", "", "Organization to trust.") cmd.Flags().BoolVar(&cfg.Trust.NoSudo, "no-sudo", false, "Disable sudo prompts.") cmd.Flags().StringVarP(&cfg.Trust.Realm, "realm", "r", "", "Realm to trust.") cmd.Flags().StringSliceVar(&cfg.Trust.Stores, "trust-stores", []string{"homebrew", "nss", "system"}, "Trust stores to update.") - cmd.MarkFlagsRequiredTogether("organization", "realm") + cmd.MarkFlagsRequiredTogether("org", "realm") cmd.Hidden = true }) diff --git a/trust/clean_test.go b/trust/clean_test.go index 4bb0e42..e5a5fc9 100644 --- a/trust/clean_test.go +++ b/trust/clean_test.go @@ -20,14 +20,14 @@ func TestCmdTrustClean(t *testing.T) { require.Equal(t, []string{"all"}, cfg.Trust.Clean.States) }) - t.Run("--organization testOrg", func(t *testing.T) { - err := cmdtest.TestError(t, CmdTrustClean, "--organization", "testOrg") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [realm]") + t.Run("--org testOrg", func(t *testing.T) { + err := cmdtest.TestError(t, CmdTrustClean, "--org", "testOrg") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [realm]") }) t.Run("-o testOrg", func(t *testing.T) { err := cmdtest.TestError(t, CmdTrustClean, "-o", "testOrg") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [realm]") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [realm]") }) t.Run("-o testOrg -r testRealm", func(t *testing.T) { @@ -38,12 +38,12 @@ func TestCmdTrustClean(t *testing.T) { t.Run("--realm testRealm", func(t *testing.T) { err := cmdtest.TestError(t, CmdTrustClean, "--realm", "testRealm") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [organization]") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [org]") }) t.Run("-r testRealm", func(t *testing.T) { err := cmdtest.TestError(t, CmdTrustClean, "-r", "testRealm") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [organization]") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [org]") }) t.Run("default --trust-stores", func(t *testing.T) { diff --git a/trust/testdata/TestCmdTrust/--help.golden b/trust/testdata/TestCmdTrust/--help.golden index 9a24d2a..bc101e3 100644 --- a/trust/testdata/TestCmdTrust/--help.golden +++ b/trust/testdata/TestCmdTrust/--help.golden @@ -15,7 +15,7 @@ Available Commands: Flags: -h, --help help for trust --no-sudo Disable sudo prompts. - -o, --organization string Organization to trust. + -o, --org string Organization to trust. -r, --realm string Realm to trust. --trust-stores strings Trust stores to update. (default [homebrew,nss,system]) diff --git a/trust/testdata/TestCmdTrustAudit/--help.golden b/trust/testdata/TestCmdTrustAudit/--help.golden index 7beb2e4..0bc2622 100644 --- a/trust/testdata/TestCmdTrustAudit/--help.golden +++ b/trust/testdata/TestCmdTrustAudit/--help.golden @@ -14,6 +14,6 @@ Usage: Flags: -h, --help help for audit - -o, --organization string Organization to trust. + -o, --org string Organization to trust. -r, --realm string Realm to trust. --trust-stores strings Trust stores to update. (default [homebrew,nss,system]) diff --git a/trust/testdata/TestCmdTrustClean/--help.golden b/trust/testdata/TestCmdTrustClean/--help.golden index ebbc30e..5e2e145 100644 --- a/trust/testdata/TestCmdTrustClean/--help.golden +++ b/trust/testdata/TestCmdTrustClean/--help.golden @@ -7,6 +7,6 @@ Flags: --cert-states strings Cert states to clean. (default [expired]) -h, --help help for clean --no-sudo Disable sudo prompts. - -o, --organization string Organization to trust. + -o, --org string Organization to trust. -r, --realm string Realm to trust. --trust-stores strings Trust stores to update. (default [homebrew,nss,system]) diff --git a/trust/trust.go b/trust/trust.go index 884241e..ec45408 100644 --- a/trust/trust.go +++ b/trust/trust.go @@ -24,12 +24,12 @@ import ( var CmdTrust = cli.NewCmd[Command](cli.CmdRoot, "trust", func(cmd *cobra.Command) { cfg := cli.ConfigFromCmd(cmd) - cmd.Flags().StringVarP(&cfg.Trust.Org, "organization", "o", "", "Organization to trust.") + cmd.Flags().StringVarP(&cfg.Trust.Org, "org", "o", "", "Organization to trust.") cmd.Flags().BoolVar(&cfg.Trust.NoSudo, "no-sudo", false, "Disable sudo prompts.") cmd.Flags().StringVarP(&cfg.Trust.Realm, "realm", "r", "", "Realm to trust.") cmd.Flags().StringSliceVar(&cfg.Trust.Stores, "trust-stores", []string{"homebrew", "nss", "system"}, "Trust stores to update.") - cmd.MarkFlagsRequiredTogether("organization", "realm") + cmd.MarkFlagsRequiredTogether("org", "realm") }) type Command struct { diff --git a/trust/trust_test.go b/trust/trust_test.go index 532853c..ed161b7 100644 --- a/trust/trust_test.go +++ b/trust/trust_test.go @@ -40,14 +40,14 @@ func TestCmdTrust(t *testing.T) { require.Equal(t, true, cfg.Trust.NoSudo) }) - t.Run("--organization testOrg", func(t *testing.T) { - err := cmdtest.TestError(t, CmdTrust, "--organization", "testOrg") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [realm]") + t.Run("--org testOrg", func(t *testing.T) { + err := cmdtest.TestError(t, CmdTrust, "--org", "testOrg") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [realm]") }) t.Run("-o testOrg", func(t *testing.T) { err := cmdtest.TestError(t, CmdTrust, "-o", "testOrg") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [realm]") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [realm]") }) t.Run("-o testOrg -r testRealm", func(t *testing.T) { @@ -58,12 +58,12 @@ func TestCmdTrust(t *testing.T) { t.Run("--realm testRealm", func(t *testing.T) { err := cmdtest.TestError(t, CmdTrust, "--realm", "testRealm") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [organization]") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [org]") }) t.Run("-r testRealm", func(t *testing.T) { err := cmdtest.TestError(t, CmdTrust, "-r", "testRealm") - require.ErrorContains(t, err, "if any flags in the group [organization realm] are set they must all be set; missing [organization]") + require.ErrorContains(t, err, "if any flags in the group [org realm] are set they must all be set; missing [org]") }) t.Run("default --trust-stores", func(t *testing.T) {