main: moved flag.Parse() into handlFlags func to clean things up

This commit is contained in:
saxon 2018-09-12 11:00:04 +09:30
parent 575edd62a2
commit b6ad8adc83
1 changed files with 2 additions and 3 deletions

View File

@ -128,14 +128,11 @@ func main() {
{"HorizontalFlip", "Flip video horizontally: Yes, No"}, {"HorizontalFlip", "Flip video horizontally: Yes, No"},
{"LogPath", "Path for logging files (default is ../)"}, {"LogPath", "Path for logging files (default is ../)"},
} }
// Create the configFlags based on the flagNames struct array // Create the configFlags based on the flagNames struct array
for i, f := range &flagNames { for i, f := range &flagNames {
configFlags[i] = flag.String(f.name, "", f.description) configFlags[i] = flag.String(f.name, "", f.description)
} }
flag.Parse()
handleFlags() handleFlags()
err := run() err := run()
@ -208,6 +205,8 @@ func run() error {
// handle flags interprets command line flags and sets revid config etc accordingly // handle flags interprets command line flags and sets revid config etc accordingly
func handleFlags() { func handleFlags() {
flag.Parse()
logPath := defaultLogPath logPath := defaultLogPath
if *configFlags[logPathPtr] != "" { if *configFlags[logPathPtr] != "" {
logPath = *configFlags[logPathPtr] logPath = *configFlags[logPathPtr]