Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/auth/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (
func codeLogin(cmd *cobra.Command, args []string) {
c := cli.New(cmd, args)
cp := common.InitProfile(c)
clientID := c.FlagHelper.GetRequiredString("client-id")
port := c.FlagHelper.GetOptionalString("port")
clientID := c.Flags.GetRequiredString("client-id")
port := c.Flags.GetOptionalString("port")
tok, err := auth.LoginWithPKCE(
cmd.Context(),
cp.GetEndpoint(),
clientID,
c.FlagHelper.GetOptionalBool("tls-no-verify"),
c.Flags.GetOptionalBool("tls-no-verify"),
port,
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/auth/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func logout(cmd *cobra.Command, args []string) {
cp.GetEndpoint(),
creds.AccessToken.ClientID,
creds.AccessToken.RefreshToken,
c.FlagHelper.GetOptionalBool("tls-no-verify"),
c.Flags.GetOptionalBool("tls-no-verify"),
); err != nil {
c.ExitWithError("An error occurred while revoking the access token", err)
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func applyOutputFormatPreference(c *cli.Cli, store *profiles.OtdfctlProfileStore
// returns the profile and the current profile store
func InitProfile(c *cli.Cli) *profiles.OtdfctlProfileStore {
var err error
profileName := c.FlagHelper.GetOptionalString("profile")
profileName := c.Flags.GetOptionalString("profile")

hasKeyringStore, err := osprofiles.HasGlobalStore(config.AppName, osprofiles.WithKeyringStore())
if err != nil {
Expand Down Expand Up @@ -89,11 +89,11 @@ func NewHandler(c *cli.Cli) handlers.Handler {
var cp *profiles.OtdfctlProfileStore

// Non-profile flags
host := c.FlagHelper.GetOptionalString("host")
tlsNoVerify := c.FlagHelper.GetOptionalBool("tls-no-verify")
withClientCreds := c.FlagHelper.GetOptionalString("with-client-creds")
withClientCredsFile := c.FlagHelper.GetOptionalString("with-client-creds-file")
withAccessToken := c.FlagHelper.GetOptionalString("with-access-token")
host := c.Flags.GetOptionalString("host")
tlsNoVerify := c.Flags.GetOptionalBool("tls-no-verify")
withClientCreds := c.Flags.GetOptionalString("with-client-creds")
withClientCredsFile := c.Flags.GetOptionalString("with-client-creds-file")
withAccessToken := c.Flags.GetOptionalString("with-access-token")
var inMemoryProfile bool

authFlags := []string{"--with-access-token", "--with-client-creds", "--with-client-creds-file"}
Expand Down
28 changes: 0 additions & 28 deletions cmd/config/config.go

This file was deleted.

10 changes: 5 additions & 5 deletions cmd/policy/attributeValues.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func createAttributeValue(cmd *cobra.Command, args []string) {
defer h.Close()

ctx := cmd.Context()
attrID := c.FlagHelper.GetRequiredID("attribute-id")
value := c.FlagHelper.GetRequiredString("value")
metadataLabels = c.FlagHelper.GetStringSlice("label", metadataLabels, cli.FlagsStringSliceOptions{Min: 0})
attrID := c.Flags.GetRequiredID("attribute-id")
value := c.Flags.GetRequiredString("value")
metadataLabels = c.Flags.GetStringSlice("label", metadataLabels, cli.FlagsStringSliceOptions{Min: 0})

attr, err := h.GetAttribute(ctx, attrID)
if err != nil {
Expand All @@ -41,7 +41,7 @@ func getAttributeValue(cmd *cobra.Command, args []string) {
h := common.NewHandler(c)
defer h.Close()

id := c.FlagHelper.GetRequiredID("id")
id := c.Flags.GetRequiredID("id")

v, err := h.GetAttributeValue(cmd.Context(), id)
if err != nil {
Expand All @@ -56,7 +56,7 @@ func listAttributeValue(cmd *cobra.Command, args []string) {
h := common.NewHandler(c)
defer h.Close()

attrID := c.FlagHelper.GetRequiredID("attribute-id")
attrID := c.Flags.GetRequiredID("attribute-id")
state := cli.GetState(cmd)
limit := c.Flags.GetRequiredInt32("limit")
offset := c.Flags.GetRequiredInt32("offset")
Expand Down
2 changes: 1 addition & 1 deletion cmd/policy/kasRegistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func getKeyAccessRegistry(cmd *cobra.Command, args []string) {
h := common.NewHandler(c)
defer h.Close()

id := c.FlagHelper.GetRequiredID("id")
id := c.Flags.GetRequiredID("id")

kas, err := h.GetKasRegistryEntry(cmd.Context(), handlers.KasIdentifier{
ID: id,
Expand Down
8 changes: 4 additions & 4 deletions cmd/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newProfilerFromCLI(c *cli.Cli) *osprofiles.Profiler {

func getDriverTypeFromUser(c *cli.Cli) profiles.ProfileDriver {
driverTypeStr := string(profiles.ProfileDriverDefault)
store := c.FlagHelper.GetOptionalString("store")
store := c.Flags.GetOptionalString("store")
if len(store) > 0 {
driverTypeStr = store
}
Expand Down Expand Up @@ -69,9 +69,9 @@ var profileCreateCmd = &cobra.Command{
profileName := args[0]
endpoint := args[1]

setDefault := c.FlagHelper.GetOptionalBool("set-default")
tlsNoVerify := c.FlagHelper.GetOptionalBool("tls-no-verify")
outputFormat := c.FlagHelper.GetOptionalString("output-format")
setDefault := c.Flags.GetOptionalBool("set-default")
tlsNoVerify := c.Flags.GetOptionalBool("tls-no-verify")
outputFormat := c.Flags.GetOptionalString("output-format")
if !profiles.IsValidOutputFormat(outputFormat) {
c.ExitWithError("Output format must be either 'styled' or 'json'", nil)
}
Expand Down
4 changes: 0 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"os"

"github.com/opentdf/otdfctl/cmd/auth"
cfg "github.com/opentdf/otdfctl/cmd/config"
"github.com/opentdf/otdfctl/cmd/dev"
"github.com/opentdf/otdfctl/cmd/policy"
"github.com/opentdf/otdfctl/cmd/tdf"
Expand Down Expand Up @@ -84,8 +83,6 @@ func init() {
}

RootCmd.AddCommand(
// config
cfg.Cmd,
// tdf
tdf.EncryptCmd,
tdf.DecryptCmd,
Expand Down Expand Up @@ -159,7 +156,6 @@ func init() {
RootCmd.AddGroup(&cobra.Group{ID: tdf.GroupID})

// Initialize all subcommands that have been refactored to use explicit initialization
cfg.InitCommands()
auth.InitCommands()
policy.InitCommands()
dev.InitCommands()
Expand Down
Loading
Loading