Lines Matching refs:arg

40 		if (isset($this->cmds[$command]['arg'])) {
41 $this->args = call_user_func(array($this, $this->cmds[$command]['arg']));
47 $arg = $argv[$i][1];
49 …self::error("Missing argument to parameter '$arg' of command '$command', check ${argv[0]} help\n");
51 $this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv);
76 foreach($this->args as $arg => $inf) {
77 if (strlen($arg) && !isset($inf['val']) && isset($inf['required']) && $inf['required']) {
78 $missing .= "Missing parameter '-$arg' to command $command, check ${argv[0]} help\n";
101 function checkArgTyp($arg, $i, $argc, $argv)
103 $typ = $this->args[$arg]['typ'];
106 … return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg], $arg);
138 return self::getSubFuncs($cmdclass, 'cli_cmd_', array('arg','inf','run'));
146 static function cli_arg_typ_bool($arg, $cfg, $key)
148 return (bool)$arg;
151 static function cli_arg_typ_int($arg, $cfg, $key)
153 if ((int)$arg != $arg) {
157 return (int)$arg;
160 static function cli_arg_typ_regex($arg, $cfg, $key)
162 if (strlen($arg)) {
163 if (strlen($arg) > 1 && $arg[0] == $arg[strlen($arg)-1] && strpos('/,', $arg) !== false) {
164 return $arg;
166 return '/' . $arg . '/';
173 static function cli_arg_typ_select($arg, $cfg, $key)
175 if (!in_array($arg, array_keys($cfg['select']))) {
176 …self::error("Parameter value '$arg' not one of '" . join("', '", array_keys($cfg['select'])) . "'.…
178 return $arg;
181 static function cli_arg_typ_dir($arg, $cfg, $key)
183 $f = realpath($arg);
186 self::error("Requested path '$arg' does not exist.\n");
191 static function cli_arg_typ_file($arg)
193 $f = new SplFileInfo($arg);
196 echo "Requested file '$arg' does not exist.\n";
202 static function cli_arg_typ_filenew($arg, $cfg, $key)
204 $d = dirname($arg);
208 self::error("Path for file '$arg' does not exist.\n");
210 return $f . '/' . basename($arg);
213 static function cli_arg_typ_filecont($arg, $cfg, $key)
215 return file_get_contents(self::cli_arg_typ_file($arg, $cfg, $key));
245 foreach(call_user_func($func, $l, $sp) as $arg => $conf) {
250 if (strlen($arg)) {
251 $arg = "-$arg ";
253 $arg = "... ";
258 $inf .= $this->cli_wordwrap($sp . $arg . $conf['inf'], $l2, $sp2) . "\n";
327 if (isset($funcs['arg'])) {
329 $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, true);
331 $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, false);