[LyX/master] Tools(listFontWithLang.pl): Prohibit inserting multiple entries of same command line option

Kornel Benko kornel at lyx.org
Thu May 21 13:49:31 UTC 2020


commit e3ffbc53cb6a8d1151772ac081f1f2db1c7c9de4
Author: Kornel Benko <kornel at lyx.org>
Date:   Thu May 21 16:09:21 2020 +0200

    Tools(listFontWithLang.pl): Prohibit inserting multiple entries of same command line option
---
 development/tools/GetOptions.pm |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/development/tools/GetOptions.pm b/development/tools/GetOptions.pm
index 5660b02..193e570 100644
--- a/development/tools/GetOptions.pm
+++ b/development/tools/GetOptions.pm
@@ -75,6 +75,18 @@ sub handleOptions($)
   while( my( $option, $value, $pretty ) = Getopt::Mixed::nextOption()) {
     if (defined($optionsDef{$option})) {
       my $fieldname = $optionsDef{$option}->{fieldname};
+      if (exists($options{$fieldname})) {
+	print "Option $option already set\n";
+	print "Value \"$value\" would overwrite ";
+	if (ref($options{$fieldname}) eq "ARRAY") {
+	  print "\"" . join(',', @{$options{$fieldname}}) . "\"\n";
+	}
+	else {
+	  print "\"$options{$fieldname}\"\n";
+	}
+	$option = "h";
+	$fieldname = "help";
+      }
       if ($option eq "h") {
         print "Syntax: $0 options xxxx ...\n";
         print "Available options:\n";


More information about the lyx-cvs mailing list