-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add profile support for cli (#289)
Co-authored-by: Jake Van Vorhis <[email protected]>
- Loading branch information
1 parent
03ecbfb
commit 15700f3
Showing
26 changed files
with
1,322 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,11 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/opentdf/otdfctl/pkg/cli" | ||
"github.com/opentdf/otdfctl/pkg/handlers" | ||
"github.com/opentdf/otdfctl/pkg/man" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var auth_clearClientCredentialsCmd = man.Docs.GetCommand("auth/clear-client-credentials", | ||
man.WithRun(auth_clearCreds), | ||
man.WithHiddenFlags("with-client-creds", "with-client-creds-file"), | ||
) | ||
|
||
func auth_clearCreds(cmd *cobra.Command, args []string) { | ||
flagHelper := cli.NewFlagHelper(cmd) | ||
host := flagHelper.GetRequiredString("host") | ||
|
||
p := cli.NewPrinter(true) | ||
|
||
p.Printf("Clearing cached client credentials for %s... ", host) | ||
if err := handlers.NewKeyring(host).DeleteClientCredentials(); err != nil { | ||
fmt.Println("failed") | ||
cli.ExitWithError("Failed to clear cached client credentials", err) | ||
} | ||
p.Println("ok") | ||
} | ||
var auth_clearClientCredentialsCmd = man.Docs.GetCommand("auth/clear-client-credentials") | ||
|
||
func init() { | ||
auth_clearClientCredentialsCmd.Flags().String( | ||
auth_clearClientCredentialsCmd.GetDocFlag("all").Name, | ||
auth_clearClientCredentialsCmd.GetDocFlag("all").Description, | ||
auth_clearClientCredentialsCmd.GetDocFlag("all").Default, | ||
) | ||
|
||
authCmd.AddCommand(&auth_clearClientCredentialsCmd.Command) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.