Browse Source

Merge pull request #372 from Morganamilo/fixparsercheck

Fix warning by megacheck in parser
Anna 7 years ago
parent
commit
37b08eabf7
1 changed files with 6 additions and 2 deletions
  1. 6 2
      parser.go

+ 6 - 2
parser.go

@@ -220,9 +220,12 @@ func (parser *arguments) getArg(options ...string) (arg string, double bool, exi
 	existCount := 0
 	existCount := 0
 
 
 	for _, option := range options {
 	for _, option := range options {
-		_, exists = parser.options[option]
+		var value string
+
+		value, exists = parser.options[option]
 
 
 		if exists {
 		if exists {
+			arg = value
 			existCount++
 			existCount++
 			_, exists = parser.doubles[option]
 			_, exists = parser.doubles[option]
 
 
@@ -232,9 +235,10 @@ func (parser *arguments) getArg(options ...string) (arg string, double bool, exi
 
 
 		}
 		}
 
 
-		arg, exists = parser.globals[option]
+		value, exists = parser.globals[option]
 
 
 		if exists {
 		if exists {
+			arg = value
 			existCount++
 			existCount++
 			_, exists = parser.doubles[option]
 			_, exists = parser.doubles[option]