Skip to content
Snippets Groups Projects
Verified Commit bb818fdb authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

refactor the execute function, the execute function should not print messages

parent 55a61783
Branches
Tags
No related merge requests found
......@@ -14,32 +14,14 @@ import (
// ExecuteWithShadow executes the command line arguments and calls the functions.
func ExecuteWithShadow[C any, D any](cmd C, cnf D) *Settings[C] {
s := execute(cmd, cnf, os.Args[0], os.Args[1:])
if s.HasErrors() {
for _, e := range s.Errors() {
fmt.Println(e)
}
}
return s
return execute(cmd, cnf, os.Args[0], os.Args[1:])
}
type noShadow struct{}
// Execute executes the command line arguments and calls the functions.
func Execute[C any](cmd C) *Settings[C] {
s := execute(cmd, noShadow{}, os.Args[0], os.Args[1:])
if s.HasErrors() {
for _, e := range s.Errors() {
fmt.Println(e)
}
}
if s.hint != "" {
fmt.Println(s.hint)
}
return s
return execute(cmd, noShadow{}, os.Args[0], os.Args[1:])
}
func (s *Settings[C]) PrintFlagOutput() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment