Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Read test commands flags from ./config.yaml file #385

Open
noaabarki opened this issue Jan 18, 2022 · 12 comments
Open

Read test commands flags from ./config.yaml file #385

noaabarki opened this issue Jan 18, 2022 · 12 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers up for grabs Looking for a contributor to take this task

Comments

@noaabarki
Copy link
Contributor

Describe the solution you'd like

Read all test command’s flags from both command and the config file(~/.datree/config.yaml). The main feature is to allow users to set permanent yet custom flags in their config local settings.

“How to implementation” Suggestion

  • Make sure all flags and options are in TestCommandFlags(wrap TestCommandFlags in TestCommandOptions as you see best).

  • Change localConfig.GetLocalConfiguration() to return all the options from ./config.yaml file.

  • Use GetLocalConfiguration() outside the scope of Cobra’s command RunE and initiate flags with local config. Eventually, the outcome should be something like

    // get local config options from local.yaml file
    localConfig := context.LocalConfig.GetLocalConfiguration()
    // initiate flags with localConfig settings
    flags := NewTestCommandFlags(localConfig)
    
    testCommand := &cobra.Command{
    		...
    		RunE: func(cmd *cobra.Command, args []string) error {...},
    	}
    
    	// overwrite flags with the command's execution flags
    	testCommandFlags.AddFlags(testCommand)
    	return testCommand

Requirements
Golang basic level.

@noaabarki noaabarki added enhancement New feature or request good first issue Good for newcomers up for grabs Looking for a contributor to take this task labels Jan 18, 2022
@RishiKumarRay
Copy link

Do we have to just paste this code

@laneia
Copy link

laneia commented Feb 1, 2022

Hey @noaabarki I’d be interested in taking this on

@noaabarki
Copy link
Contributor Author

Hi @laneia! That's amazing, you got it :)

@dimabru
Copy link
Contributor

dimabru commented Feb 2, 2022

Will this cause us to override the flags without the ability to change it via the cli?

To be more specific, I will be able to manually add schema-version flag to config.yaml but will not have the ability to use the cli to override it using datree config set schema-version
Or even check what is set using datree config get schema-version

@royhadad
Copy link
Contributor

royhadad commented Apr 7, 2022

Will this cause us to override the flags without the ability to change it via the cli?

To be more specific, I will be able to manually add schema-version flag to config.yaml but will not have the ability to use the cli to override it using datree config set schema-version
Or even check what is set using datree config get schema-version

As with most tools, I think we want the inline flags to merge & override the flags from config.yaml

@naorpeled
Copy link
Contributor

@noaabarki I would like to work on this issue :)

@noaabarki
Copy link
Contributor Author

You are the best! 🥳 It's yours.

@naorpeled
Copy link
Contributor

Hey @noaabarki,
didn't have much time to work on this task in the past few weeks :(

Wanted to get it done within the day that I was assigned but got a bit stuck,
will try to get it done this week.

@naorpeled naorpeled removed their assignment Jul 14, 2022
@amustaque97
Copy link
Contributor

@noaabarki is anyone working on this issue?

@royhadad
Copy link
Contributor

royhadad commented Nov 2, 2022

@amustaque97 Nope, feel free to give it a shot :)

@Abhi-y2003
Copy link

@noaabarki is there anyone working on this issue?
I would like to work on this : )

@eyarz
Copy link
Member

eyarz commented Jun 6, 2023

@Abhi-y2003 go for it!

@eyarz eyarz assigned Abhi-y2003 and unassigned noaabarki Jun 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers up for grabs Looking for a contributor to take this task
Projects
None yet
Development

No branches or pull requests

9 participants