facebook/hh-clilib
最新稳定版本:v2.6.0
Composer 安装命令:
composer require facebook/hh-clilib
包简介
无描述信息
README 文档
README
This library provides basic command-line handling, including:
- parsing of
ARGV - interactive TTY detection
- color TTY detection
It aims for as much code as possible to be in strict mode.
Installation
hhvm composer.phar require facebook/hh-clilib Examples
In src/MyCLI.hh:
// MyCLI.hh <?hh // strict use type Facebook\CLILib\CLIBase; final class MyCLI extends CLIBase { <<__Override>> public async function mainAsync(): Awaitable<int> { $this->getStdout()->write("Hello, world!"); return 0; } }
In bin/mycli:
<?hh // not strict because of top-level statements. require_once(__DIR__.'/../vendor/hh_autoload.php'); MyCLI::main();
Options
Options are optional, always have a long form (e.g. --foo), may have a short form (e.g. -f), and may require a value (e.g. --foo=bar or --foo bar).
You can specify supported options by implemented getSupportedOptions(); --help is always supported.
<<__Override>> protected function getSupportedOptions(): vec<CLIOptions\CLIOption> { return vec[ CLIOptions\flag( () ==> { $this->verbosity++; }, "Increase output verbosity", '--verbose', '-v', ), CLIOptions\with_required_enum( OutputFormat::class, $f ==> { $this->format = $f; }, Str\format( "Desired output format (%s). Default: %s", Str\join(OutputFormat::getValues(), '|'), (string) $this->format, ), '--format', '-f', ), CLIOptions\with_required_string( $s ==> { $this->outputRoot = $s; }, "Directory for output files. Default: working directory", '--output', '-o', ), ]; }
Arguments
Arguments do not have a name, and may be required. To support arguments, extend CLIWithArguments or CLIWithRequiredArguments.
Arguments are always strings, and can be retrieved via ->getArguments();
Contributing
See CONTRIBUTING.md.
License
hh-clilib is MIT-licensed.
facebook/hh-clilib 适用场景与选型建议
facebook/hh-clilib 是一款 基于 Hack 开发的 Composer 扩展包,目前已累计 762.15k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 facebook/hh-clilib 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 facebook/hh-clilib 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 762.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 16
- 依赖项目数: 15
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04