Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable output styling for cli and tfrobot #1242

Open
wants to merge 8 commits into
base: development
Choose a base branch
from

Conversation

Eslam-Nawara
Copy link
Contributor

@Eslam-Nawara Eslam-Nawara commented Nov 4, 2024

Description

add flag to disable output styling for cli and tfrobot

Related Issues

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstring

@Eslam-Nawara Eslam-Nawara force-pushed the development-disable-output-styling-cli branch from 66382ad to 4f0a1ac Compare November 5, 2024 13:44
@rawdaGastan
Copy link
Collaborator

Can you update the pr with the difference?

@Eslam-Nawara
Copy link
Contributor Author

here I loaded a deployment with and without --no-color flag

➜  grid-cli git:(development-disable-output-styling-cli) ✗ go run main.go get vm test &> output1
➜  grid-cli git:(development-disable-output-styling-cli) ✗ go run main.go get vm test --no-color &> output2

and as the issue specifies the output is wrapped in escape sequences, so I added an option to disable that if the user need to get the values without wrapping them
image

@Eslam-Nawara Eslam-Nawara force-pushed the development-disable-output-styling-cli branch from fed0485 to 3801121 Compare January 20, 2025 09:13
@@ -17,12 +17,26 @@ var getContractCmd = &cobra.Command{
Use: "contract",
Short: "Get twin contract",
Run: func(cmd *cobra.Command, args []string) {
noColor, err := cmd.Flags().GetBool("no-color")
if err != nil {
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would I know the error here? check other files

@@ -50,4 +64,5 @@ var getContractCmd = &cobra.Command{

func init() {
getCmd.AddCommand(getContractCmd)
getContractCmd.Flags().Bool("no-color", false, "disable output styling")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not adding it to the parent command instead of adding it for every subcommand?

return fmt.Errorf("invalid log debug mode input '%v' with error: %w", debug, err)
}

zerolog.SetGlobalLevel(zerolog.InfoLevel)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removing this?

log.Error().Msg("deployments failed with errors: ")
fmt.Println(errs)
os.Exit(1)
if errs := deployer.RunDeployer(context.Background(), cfg, tfPluginClient, outputPath, debug); errs != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not taking command ctx?

log.Error().Msg("failed to load configured deployments")
fmt.Println(err)
os.Exit(1)
if err := deployer.RunLoader(context.Background(), cfg, tfPluginClient, debug, outputPath); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, why not using command ctx?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants