kilahm/clio

Command Line Input/Output for Hack.

Maintainers

Details

github.com/kilahm/clio

Source

Issues

Installs: 62

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:Hack

0.2.2 2015-05-17 03:18 UTC

This package is not auto-updated.

Last update: 2024-11-09 18:06:31 UTC


README

This package is a re-imagining of the wonderful League package Climate, except written in strict Hack.

WHY?!

I would really like to have useful tools for Hack. The primary advantage I see that Hack has over PHP is the static type checker. For the type checker to be useful, there needs to be statically typed libraries.

Usage

The API is unstable

For now I will list example code. This is one way in which I design my public facing APIs.

Construction

// 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);

Parameters/Options

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')

Contributing

I would love to have feedback. Pull requests and issues are welcome!