diff --git a/app/Commands/Command.php b/app/Commands/Command.php new file mode 100644 index 0000000..e14d2db --- /dev/null +++ b/app/Commands/Command.php @@ -0,0 +1,22 @@ +error($quit->getMessage()); + + return $quit->getCode() > 0 ? $quit->getCode() : 1; + } + } +} diff --git a/app/Commands/GetShow.php b/app/Commands/GetShow.php new file mode 100644 index 0000000..240298b --- /dev/null +++ b/app/Commands/GetShow.php @@ -0,0 +1,49 @@ +line(json_encode($this->options())); + # $this->ask('What?'); + # throw new Quit('Nope', 5); + $files = $this->getFiles(); + if ($this->confirm('Do you wish to continue?', true)) { + $this->line(json_encode($files)); + } + + return static::SUCCESS; + } + + protected function getFiles(): array + { + $input = $this->option('input'); + if (empty($input)) { + throw new Quit('No files given'); + } + + $files = array_map(function (string $file) { + if (!file_exists($file)) { + throw new Quit("$file is not a valid file"); + } + + return realpath($file); + }, $input); + + return $files; + } +} diff --git a/app/Commands/InspireCommand.php b/app/Commands/InspireCommand.php deleted file mode 100644 index 20afdca..0000000 --- a/app/Commands/InspireCommand.php +++ /dev/null @@ -1,52 +0,0 @@ - -