This repository was archived by the owner on Jun 6, 2024. It is now read-only.
This repository was archived by the owner on Jun 6, 2024. It is now read-only.
Read test commands flags from ./config.yaml file #385
Open
Description
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
(wrapTestCommandFlags
inTestCommandOptions
as you see best). -
Change
localConfig.GetLocalConfiguration()
to return all the options from./config.yaml
file. -
Use
GetLocalConfiguration()
outside the scope of Cobra’s commandRunE
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.