-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/subject-mappings
- Loading branch information
Showing
16 changed files
with
319 additions
and
150 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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/opentdf/tructl/internal/config" | ||
"github.com/opentdf/tructl/pkg/cli" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// configCmd is the command for managing configuration | ||
var configCmd = &cobra.Command{ | ||
Use: "config", | ||
Short: "Manage configuration", | ||
Long: ` | ||
Manage configuration within 'tructl'. | ||
Configuration is used to manage the configuration of the 'tructl' command line tool and updates the | ||
config .yaml file in the root directory when changes have been made. | ||
`, | ||
} | ||
|
||
var updateOutputFormatCmd = &cobra.Command{ | ||
Use: "output", | ||
Short: "Define the configured output format", | ||
Long: ` | ||
Define the configured output format for the 'tructl' command line tool. The only supported outputs at | ||
this time are 'json' and styled CLI output, which is the default when unspecified. | ||
`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
h := cli.NewHandler(cmd) | ||
defer h.Close() | ||
|
||
flagHelper := cli.NewFlagHelper(cmd) | ||
format := flagHelper.GetRequiredString("format") | ||
|
||
config.UpdateOutputFormat(format) | ||
fmt.Println(cli.SuccessMessage(fmt.Sprintf("Output format updated to %s", format))) | ||
}, | ||
} | ||
|
||
func init() { | ||
updateOutputFormatCmd.Flags().String("format", "", "'json' or 'styled' as the configured output format") | ||
configCmd.AddCommand(updateOutputFormatCmd) | ||
rootCmd.AddCommand(configCmd) | ||
} |
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.