datree icon indicating copy to clipboard operation
datree copied to clipboard

Read test commands flags from ./config.yaml file

Open noaabarki opened this issue 2 years ago ā€¢ 12 comments

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 avatar Jan 18 '22 08:01 noaabarki

Do we have to just paste this code

RishiKumarRay avatar Jan 18 '22 09:01 RishiKumarRay

Hey @noaabarki Iā€™d be interested in taking this on

laneia avatar Feb 01 '22 17:02 laneia

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

noaabarki avatar Feb 02 '22 08:02 noaabarki

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

dimabru avatar Feb 02 '22 09:02 dimabru

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

royhadad avatar Apr 07 '22 16:04 royhadad

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

naorpeled avatar Apr 21 '22 10:04 naorpeled

You are the best! šŸ„³ It's yours.

noaabarki avatar Apr 24 '22 07:04 noaabarki

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 avatar May 14 '22 23:05 naorpeled

@noaabarki is anyone working on this issue?

amustaque97 avatar Nov 01 '22 11:11 amustaque97

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

royhadad avatar Nov 02 '22 14:11 royhadad

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

Abhi-y2003 avatar Jun 06 '23 06:06 Abhi-y2003

@Abhi-y2003 go for it!

eyarz avatar Jun 06 '23 08:06 eyarz