rde/php-terminal

處理php終端機輸出

v0.1.3 2015-11-02 09:17 UTC

This package is not auto-updated.

Last update: 2024-11-09 18:59:25 UTC


README

Build Status

Flag

cmd.php

use Rde\Flag;

$flag = new Flag;

// 取參照
$str = &$flag->string('str-name', 'default', 'describes...');

// 傳參照
$flag->intVar($int, 'int-name', 0, 'describes...');

// 解析
$args = $flag->parse($argv);

var_dump($args, $str, $int);

cli

./cmd.php --str-name abc --int-name 123 x y z

output

array(3) {
  [0] =>
  string(1) "x"
  [1] =>
  string(1) "y"
  [2] =>
  string(1) "z"
}
string(3) "abc"
int(123)