<?php
use Bauhaus\Cli;
use Bauhaus\CliSettings;
use Bauhaus\Cli\Entrypoint;
use Bauhaus\Cli\Input;
use Bauhaus\Cli\Output;
use Bauhaus\Cli\Processor\Middleware;
use Bauhaus\Cli\Attribute\Name;
use Bauhaus\Cli\Processor\Handler;
#[Name('command-id')]
class MyCliEntrypoint implements Entrypoint
{
public function execute(Input $input, Output $output): void
{
$output->write("my entrypoing\n");
}
}
class MyCliMiddleware implements Middleware
{
public function execute(Input $input,Output $output, Handler $next): void
{
$output->write("my middleware\n");
$next->execute($input, $output);
}
}
$settings = CliSettings::default()
->withOutput('/var/tmp/file') // default is php:https://stdout
->withEntrypoints(
new MyCliEntrypoint(),
)
->withMiddlewares(
new MyCliMiddleware(),
);
$cliApplication = Cli::bootstrap($settings);
$cliApplication->run('./bin', 'command-id'); // it could be $cliApplication->run($_SERVER['argv']);
-
Notifications
You must be signed in to change notification settings - Fork 0
License
bauhausphp/cli
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published