Browse Source

Allow yes/no and on/off as flag values.

Most flag names are words for which a Boolean parameter makes no sense grammatically.

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8102 8c9fc860-2736-0410-a75d-ab315db34111
negelef 7 years ago
parent
commit
7046ec35e5
1 changed files with 5 additions and 5 deletions
  1. 5 5
      source/Options.Mod

+ 5 - 5
source/Options.Mod

@@ -510,12 +510,12 @@ TYPE
 					options[index].timestamp := timestamp;
 					CASE options[index].type OF
 					| Flag:
-						IF (string = "false") THEN
-							options[index].isSet := FALSE;
-							RETURN TRUE;
-						ELSIF (string = "true") THEN
+						IF (string = "yes") | (string = "on") | (string = "true") THEN
 							options[index].isSet := TRUE;
 							RETURN TRUE;
+						ELSIF (string = "no") | (string = "off") | (string = "false") THEN
+							options[index].isSet := FALSE;
+							RETURN TRUE;
 						ELSIF (error # NIL) THEN
 							error.String("Option "); ShowOption(ch, name);
 							error.String(" expects a boolean parameter"); error.Ln;
@@ -806,6 +806,6 @@ Options.Test -afds -b --fdas ~
 Options.Test -f  -s=fds ~
 
 Options.Test -f=true ~
-Options.Test --flag=false ~
+Options.Test --flag=no ~
 
 System.Free Options ~