Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ilya-dev
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilya-dev/11376502 to your computer and use it in GitHub Desktop.
Save ilya-dev/11376502 to your computer and use it in GitHub Desktop.
Something I am working on...
<?php
// command-name {name:required} {age:optional:"Jack"}
// command-name {--name} {--age:required} {--country:optional:USA}
// facade:resolve "Show underlying classes and the corresponding IoC bindings" {query:optional:"Query string":"*"}
listen("say-hello")->act(function($input, $output) {
$output("Hello, world!");
});
listen("say-name {--name:required:Generic}")->act(function($input, $output) {
$output("Hello, ".$input("name"));
});
listen("do-something {age:required} {country:optional:USA} {--save:optional} {--path:required}")
->act(function($input, $output)
{
$savePath = $input("save") ? $input("path", "generic/path") : null;
$message = sprintf("%s:%s => %s", $input("age"), $input("country"), $savePath);
$output($message);
});
go();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment