diff options
author | Christian Helbling | 2018-10-29 13:52:51 +0100 |
---|---|---|
committer | Christian Helbling | 2018-10-29 13:52:51 +0100 |
commit | 95a5aa61f38487d11a089ae2e9cadb5240201685 (patch) | |
tree | 7b74cde63aa74fcfc6d18403a51ba177df310f53 | |
parent | ddbe04f2924cfc6e3a00fd8df57d3ed14cff71fa (diff) | |
download | itools-95a5aa61f38487d11a089ae2e9cadb5240201685.tar.gz itools-95a5aa61f38487d11a089ae2e9cadb5240201685.tar.bz2 itools-95a5aa61f38487d11a089ae2e9cadb5240201685.zip |
warn when using the same short option twice
-rw-r--r-- | it.class | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -839,7 +839,11 @@ static function getopt($usage, $p = array()) if ($longoptname || $shortoptname) { if ($longoptname && ($shortoptname || $shortoptname === "0")) + { + if ($alias[$shortoptname]) + it::error("getopt: short option -$shortoptname is used twice: --{$alias[$shortoptname]} and --$longoptname!"); $alias[$shortoptname] = $longoptname; + } $witharg[$longoptname ? $longoptname : $shortoptname] = $longoptarg || $shortoptarg; } |