Restructure Meta.process to logically group code

This commit is contained in:
Robert Liebowitz 2017-06-21 21:52:40 -04:00 committed by Martin Atkins
parent 8d98fdecac
commit e67ecb5ce2
1 changed files with 12 additions and 12 deletions

View File

@ -382,6 +382,18 @@ func (m *Meta) process(args []string, vars bool) ([]string, error) {
// the args...
m.autoKey = ""
if vars {
var preArgs []string
if _, err := os.Stat(DefaultVarsFilename); err == nil {
m.autoKey = "var-file-default"
preArgs = append(preArgs, "-"+m.autoKey, DefaultVarsFilename)
}
if _, err := os.Stat(DefaultVarsFilename + ".json"); err == nil {
m.autoKey = "var-file-default"
preArgs = append(preArgs, "-"+m.autoKey, DefaultVarsFilename+".json")
}
wd, err := os.Getwd()
if err != nil {
return nil, err
@ -400,18 +412,6 @@ func (m *Meta) process(args []string, vars bool) ([]string, error) {
return nil, err
}
var preArgs []string
if _, err = os.Stat(DefaultVarsFilename); err == nil {
m.autoKey = "var-file-default"
preArgs = append(preArgs, "-"+m.autoKey, DefaultVarsFilename)
}
if _, err = os.Stat(DefaultVarsFilename + ".json"); err == nil {
m.autoKey = "var-file-default"
preArgs = append(preArgs, "-"+m.autoKey, DefaultVarsFilename+".json")
}
err = nil
for err != io.EOF {
var fis []os.FileInfo