-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
103 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tempest\Console\Exceptions; | ||
|
||
use Tempest\Console\ConsoleOutput; | ||
|
||
final class CommandNotFoundException extends ConsoleException | ||
{ | ||
public function __construct( | ||
private readonly string $commandName | ||
) {} | ||
|
||
public function render(ConsoleOutput $output): void | ||
{ | ||
$output->writeln( | ||
sprintf('Command %s not found', $this->commandName), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Tempest\Console\Exceptions; | ||
|
||
use RuntimeException; | ||
use Tempest\Console\ConsoleOutput; | ||
|
||
abstract class ConsoleException extends RuntimeException | ||
{ | ||
abstract public function render(ConsoleOutput $output): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Tempest\Console\Exceptions; | ||
|
||
use Tempest\Console\Actions\RenderConsoleCommand; | ||
use Tempest\Console\ConsoleCommand; | ||
use Tempest\Console\ConsoleOutput; | ||
|
||
final class InvalidCommandException extends ConsoleException | ||
{ | ||
public function __construct( | ||
private readonly string $initialCommand, | ||
private readonly ConsoleCommand $consoleCommand, | ||
) {} | ||
|
||
public function render(ConsoleOutput $output): void | ||
{ | ||
$output->error("Invalid command: {$this->initialCommand}"); | ||
|
||
(new RenderConsoleCommand($output))($this->consoleCommand); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters