summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class6
-rwxr-xr-xtests/exec.t8
2 files changed, 7 insertions, 7 deletions
diff --git a/it.class b/it.class
index 0c6d4a6..18f9ffc 100644
--- a/it.class
+++ b/it.class
@@ -550,16 +550,16 @@ static function shell_command(/* $cmd, $values1 = array(), ... */)
#for escapeshellarg in it::_exec_quotevalue
$oldlocale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, 'de_CH');
- foreach (it::match('({(-?-?)([a-z0-9]\w*)})', $cmd, array('all' => true)) as $tags)
+ foreach (it::match('({(-?)([a-z0-9]\w*)})', $cmd, array('all' => true)) as $tags)
{
list($tag, $option, $key) = $tags;
$parts = array();
if ($option)
{
- foreach ((array)$values[$option . $key] as $key => $value)
+ foreach ((array)$values["-$key"] as $key => $value)
{
- if ($option == '--')
+ if ($key[0] != '-')
$key = ($key[1] ? '--' : '-') . $key;
if ($value === true || $value === false || $value === null)
$parts[] = $value ? $key : "";
diff --git a/tests/exec.t b/tests/exec.t
index 4702681..da5113d 100755
--- a/tests/exec.t
+++ b/tests/exec.t
@@ -52,14 +52,14 @@ is(
"... with disabled short option"
);
is(
- it::shell_command("echo {--opts}", array('--opts' => array('longopt' => true))),
+ it::shell_command("echo {-opts}", array('-opts' => array('longopt' => true))),
"echo --longopt",
- "... long option without dashes for --opts"
+ "... long option without dashes"
);
is(
- it::shell_command("echo {--opts}", array('--opts' => array('s' => true))),
+ it::shell_command("echo {-opts}", array('-opts' => array('s' => true))),
"echo -s",
- "... short option without dashes for --opts"
+ "... short option without dashes"
);
foreach (array("", "C", "de_CH", "de_CH.utf8") as $locale) {