kilahm/clio

Hack 的命令行输入/输出

维护者

详细信息

github.com/kilahm/clio

源代码

问题

安装: 60

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放性问题: 0

语言:Hack

0.2.2 2015-05-17 03:18 UTC

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 都很受欢迎!