2017 © Pedro Peláez
 

library cliadr

Command line ADR implementation

image

cadre/cliadr

Command line ADR implementation

  • Wednesday, September 27, 2017
  • by andrewshell
  • Repository
  • 2 Watchers
  • 2 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Cadre.CliAdr

This is a proof of concept command line Action-Domain-Responder (ADR) implementation., (*1)

It's heavily inspired by Radar., (*2)

Example

use Aura\Cli\CliFactory;
use Aura\Cli\Context;
use Aura\Cli\Help;
use Aura\Cli\Stdio;
use Cadre\CliAdr\Boot;
use Cadre\CliAdr\Input\HelpAwareInterface;

require __DIR__ . '/vendor/autoload.php';

$boot = new Boot();
$adr = $boot->adr();

$adr->route('hello', function ($name) {
    return "Hello, {$name}";
})->input(new class implements HelpAwareInterface {
    public function help(Help $help)
    {
        $help->setSummary('Hello, World');
        $help->setOptions([
            '#name?' => 'First name [default: "World"]',
        ]);

        return $help;
    }

    public function __invoke(Context $context)
    {
        $getopt = $context->getopt([]);
        return [$getopt->get(2, 'World')];
    }
});

$factory = new CliFactory();
$context = $factory->newContext($GLOBALS);
$stdio = $factory->newStdio();

exit($adr->run($context, $stdio));

The Versions

27/09 2017

0.x-dev

0.9999999.9999999.9999999-dev

Command line ADR implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrew Shell

06/07 2017

0.2.0

0.2.0.0

Command line ADR implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrew Shell

01/07 2017

0.1.2

0.1.2.0

Command line ADR implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrew Shell

18/03 2017
22/10 2016

0.1.0

0.1.0.0

Command line ADR implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrew Shell