Read test commands flags from ./config.yaml file
Author: noaabarkiCreated Jan 18, 2022Updated Jun 6, 2023
Labelsenhancementgood first issueup for grabs
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(wrapTestCommandFlagsinTestCommandOptionsas you see best).Change
localConfig.GetLocalConfiguration()to return all the options from./config.yamlfile.Use
GetLocalConfiguration()outside the scope of Cobra’s commandRunEand 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.
Source: datreeio/datree