}
else
{
- $typ = $this->args[$arg]['typ'];
-
- if (isset($this->typs[$typ]['typ']))
- {
- $this->args[$arg]['val'] = call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg]);
- }
- else
- {
- $this->args[$arg]['val'] = $argv[$i];
- }
+ $this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv);
}
}
else
call_user_func(array($this, $this->cmds[$command]['run']), $this->args);
}
+ function checkArgTyp($arg, $i, $argc, $argv)
+ {
+ $typ = $this->args[$arg]['typ'];
+
+ if (isset($this->typs[$typ]['typ']))
+ {
+ return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg]);
+ }
+ else
+ {
+ return $argv[$i];
+ }
+ }
+
static function getSubFuncs(CLICommand $cmdclass, $prefix, array $subs)
{
$a = array();
}
else
{
- $typ = $this->args[$arg]['typ'];
-
- if (isset($this->typs[$typ]['typ']))
- {
- $this->args[$arg]['val'] = call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg]);
- }
- else
- {
- $this->args[$arg]['val'] = $argv[$i];
- }
+ $this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv);
}
}
else
call_user_func(array($this, $this->cmds[$command]['run']), $this->args);
}
+ function checkArgTyp($arg, $i, $argc, $argv)
+ {
+ $typ = $this->args[$arg]['typ'];
+
+ if (isset($this->typs[$typ]['typ']))
+ {
+ return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg]);
+ }
+ else
+ {
+ return $argv[$i];
+ }
+ }
+
static function getSubFuncs(CLICommand $cmdclass, $prefix, array $subs)
{
$a = array();
static function cli_arg_typ_dir($arg)
{
$f = realpath($arg);
-echo "DIR: '$arg' = '$f'\n";
if ($f===false || !file_exists($f) || !is_dir($f))
{
echo "Requested path '$arg' does not exist.\n";