summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorNathan Gass2013-07-17 10:21:36 +0000
committerNathan Gass2013-07-17 10:21:36 +0000
commit48251be9125f8e23df180126d50422b0e6561030 (patch)
treec4eff0421149faf8514c38ab0ebaa762791c9ed7 /it.class
parent9d908d61e587b1b34347635bb22d133314d8093a (diff)
downloaditools-48251be9125f8e23df180126d50422b0e6561030.tar.gz
itools-48251be9125f8e23df180126d50422b0e6561030.tar.bz2
itools-48251be9125f8e23df180126d50422b0e6561030.zip
add --opts variant to shell_command which adds dashes for posix options, add tests for -opts and --opts
Diffstat (limited to 'it.class')
-rw-r--r--it.class6
1 files changed, 4 insertions, 2 deletions
diff --git a/it.class b/it.class
index 14cd8a2..0c6d4a6 100644
--- a/it.class
+++ b/it.class
@@ -550,15 +550,17 @@ 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["-$key"] as $key => $value)
+ foreach ((array)$values[$option . $key] as $key => $value)
{
+ if ($option == '--')
+ $key = ($key[1] ? '--' : '-') . $key;
if ($value === true || $value === false || $value === null)
$parts[] = $value ? $key : "";
else foreach ((array)$value as $val)