kilahm / clio
Hack 的命令行输入/输出
0.2.2
2015-05-17 03:18 UTC
Requires
- hhvm: >=3.5.0
Requires (Dev)
- hackpack/hackunit: 0.3.*
This package is not auto-updated.
Last update: 2024-09-14 17:05:21 UTC
README
这个包是对优秀的 League 包 Climate 的重新构想,除了是用严格的 Hack 编写。
为什么?
我真的很希望有有用的 Hack 工具。我认为 Hack 相比 PHP 的主要优势是静态类型检查器。为了让类型检查器有用,需要有静态类型库。
用法
API 不稳定
目前我会列出示例代码。这是我设计公共接口API的一种方式。
构建
// Default input and output; same as not passing any input/output handlers to clio constructor $input = new HackPack\Clio\StreamReader(STDIN); $output = new HackPack\Clio\StreamWriter(STDOUT); $clio = new HackPack\Clio\Clio($input, $output);
参数/选项
hhvm task.php "Some Call Me Tim" --with-title -t "Tim The Wizard"
// task.php $clio = new HackPack\Clio\Clio(); $name = $clio->param('name') ->described('Description of the "name" argument.') ->required(); $titleFlag = $clio->flag('with-title') $title = $clio->option('title')->aka('t')
贡献
我非常欢迎反馈。Pull requests 和 issues 都很受欢迎!