-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli-note
executable file
·46 lines (37 loc) · 1.62 KB
/
cli-note
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env php
<?php
use jæm3l\CliNote\Slide;
use jæm3l\CliNote\DependencyInjection\SlidePass;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
require 'vendor/autoload.php';
ErrorHandler::register();
$container = new ContainerBuilder();
// Configure console.
$container->addCompilerPass(new AddConsoleCommandPass());
$container->registerForAutoconfiguration(Command::class)
->addTag('console.command');
// Configure event dispatcher.
$container->setParameter('event_dispatcher.event_aliases', ConsoleEvents::ALIASES);
$container->addCompilerPass(new RegisterListenersPass());
$container->registerForAutoconfiguration(EventSubscriberInterface::class)
->addTag('kernel.event_subscriber');
// Configure slides.
$container->addCompilerPass(new SlidePass());
$container->registerForAutoconfiguration(Slide::class)
->addTag('cli_note.slide');
// Load slides.yaml.
(new YamlFileLoader($container, new FileLocator(__DIR__.'/config')))->load('services.yaml');
(new YamlFileLoader($container, new FileLocator(getcwd())))->load('slides.yaml');
$container->setParameter('base_path', getcwd());
$container->compile();
$container
->get('CliNote')
->run();