🔨Cobra package replaced with standard flag package

This commit is contained in:
2024-12-18 20:58:14 +04:00
parent 04e5b5f3eb
commit 186683fce5
7 changed files with 123 additions and 72 deletions

12
main.go
View File

@@ -27,9 +27,13 @@ func main() {
)
cliConf, err := readers.CLIConfigReader()
if err != nil || cliConf == nil {
if err != nil {
utils.PrintAndExit(err.Error())
}
if cliConf == nil {
os.Exit(0)
}
if err := validator.StructPartial(cliConf, "ConfigFile"); err != nil {
utils.PrintErrAndExit(
customerrors.ValidationErrorsFormater(
@@ -82,11 +86,11 @@ func main() {
Cookies: jsonConf.Cookies,
Proxies: jsonConf.Proxies,
Body: jsonConf.Body,
Yes: cliConf.Yes,
NoProxyCheck: conf.NoProxyCheck.ValueOrPanic(),
Yes: cliConf.Yes.ValueOr(false),
NoProxyCheck: conf.NoProxyCheck.ValueOr(false),
}
requestConf.Print()
if !cliConf.Yes {
if !cliConf.Yes.ValueOr(false) {
response := readers.CLIYesOrNoReader("Do you want to continue?", true)
if !response {
utils.PrintAndExit("Exiting...")