mirror of
https://github.com/aykhans/dodo.git
synced 2025-07-02 08:16:45 +00:00
✨ Added 'no-proxy-check' parameter
This commit is contained in:
@ -13,10 +13,15 @@ import (
|
||||
func CLIConfigReader() (*config.CLIConfig, error) {
|
||||
var (
|
||||
returnNil = false
|
||||
cliConfig = &config.CLIConfig{}
|
||||
cliConfig = &config.CLIConfig{
|
||||
Config: config.Config{
|
||||
NoProxyCheck: utils.NewNoneOption[bool](),
|
||||
},
|
||||
}
|
||||
dodosCount uint
|
||||
requestCount uint
|
||||
timeout uint32
|
||||
noProxyCheck bool
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "dodo [flags]",
|
||||
Example: ` Simple usage only with URL:
|
||||
@ -51,6 +56,7 @@ func CLIConfigReader() (*config.CLIConfig, error) {
|
||||
rootCmd.Flags().UintVarP(&dodosCount, "dodos-count", "d", config.DefaultDodosCount, "Number of dodos(threads)")
|
||||
rootCmd.Flags().UintVarP(&requestCount, "request-count", "r", config.DefaultRequestCount, "Number of total requests")
|
||||
rootCmd.Flags().Uint32VarP(&timeout, "timeout", "t", config.DefaultTimeout, "Timeout for each request in milliseconds")
|
||||
rootCmd.Flags().BoolVarP(&noProxyCheck, "no-proxy-check", "n", false, "Do not check for proxy")
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
utils.PrintErr(err)
|
||||
rootCmd.Println(rootCmd.UsageString())
|
||||
@ -68,6 +74,8 @@ func CLIConfigReader() (*config.CLIConfig, error) {
|
||||
cliConfig.RequestCount = requestCount
|
||||
case "timeout":
|
||||
cliConfig.Timeout = timeout
|
||||
case "no-proxy-check":
|
||||
cliConfig.NoProxyCheck = utils.NewOption(noProxyCheck)
|
||||
}
|
||||
})
|
||||
if returnNil {
|
||||
|
@ -5,7 +5,8 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/aykhans/dodo/config"
|
||||
"github.com/aykhans/dodo/custom_errors"
|
||||
customerrors "github.com/aykhans/dodo/custom_errors"
|
||||
"github.com/aykhans/dodo/utils"
|
||||
)
|
||||
|
||||
func JSONConfigReader(filePath string) (*config.JSONConfig, error) {
|
||||
@ -13,7 +14,11 @@ func JSONConfigReader(filePath string) (*config.JSONConfig, error) {
|
||||
if err != nil {
|
||||
return nil, customerrors.OSErrorFormater(err)
|
||||
}
|
||||
jsonConf := &config.JSONConfig{}
|
||||
jsonConf := &config.JSONConfig{
|
||||
Config: config.Config{
|
||||
NoProxyCheck: utils.NewNoneOption[bool](),
|
||||
},
|
||||
}
|
||||
err = json.Unmarshal(data, &jsonConf)
|
||||
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user