Skip to content

Commit

Permalink
Write command runners instead of "shortcuts"
Browse files Browse the repository at this point in the history
Eliminating the need for vendor/bin/parable and thus Parable\Framework\*
In preparation of upgrading from parable to parable-php

Refs #5
  • Loading branch information
dmvdbrugge committed Sep 18, 2018
1 parent 740ad97 commit fddf3a5
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/Command/Ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Ui extends Command
{
protected $name = 'ui';
protected $name = 'csv2qif';

protected $description = 'Shows a UI for convert/validate';

Expand Down
24 changes: 0 additions & 24 deletions app/Config/App.php

This file was deleted.

17 changes: 15 additions & 2 deletions convert
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
#!/usr/bin/env bash
vendor/bin/parable convert $*
#!/usr/bin/env php
<?php

use Csv2Qif\Command\Convert;
use Parable\Console\App;
use Parable\DI\Container;

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

$cmd = Container::get(Convert::class);

Container::get(App::class)
->setDefaultCommand($cmd)
->setOnlyUseDefaultCommand(true)
->run();
18 changes: 15 additions & 3 deletions csv2qif
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
#!/usr/bin/env bash
cd "`dirname "$0"`"
vendor/bin/parable ui
#!/usr/bin/env php
<?php

use Csv2Qif\Command\Ui;
use Parable\Console\App;
use Parable\DI\Container;

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

$cmd = Container::get(Ui::class);

Container::get(App::class)
->setDefaultCommand($cmd)
->setOnlyUseDefaultCommand(true)
->run();
23 changes: 23 additions & 0 deletions help
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

use Csv2Qif\Command\Convert;
use Csv2Qif\Command\Ui;
use Csv2Qif\Command\Validate;
use Parable\Console\App;
use Parable\Console\Command\Help;
use Parable\DI\Container;

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

$cmd = Container::get(Help::class);

Container::get(App::class)
->setDefaultCommand($cmd)
->setOnlyUseDefaultCommand(true)
->addCommands([
Container::get(Convert::class),
Container::get(Ui::class),
Container::get(Validate::class),
])
->run();
17 changes: 15 additions & 2 deletions validate
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
#!/usr/bin/env bash
vendor/bin/parable validate $*
#!/usr/bin/env php
<?php

use Csv2Qif\Command\Validate;
use Parable\Console\App;
use Parable\DI\Container;

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

$cmd = Container::get(Validate::class);

Container::get(App::class)
->setDefaultCommand($cmd)
->setOnlyUseDefaultCommand(true)
->run();

0 comments on commit fddf3a5

Please sign in to comment.