diff --git a/src/Console/CommandArgs.php b/src/Console/CommandArgs.php index 5d0efda3..c97c1ad7 100644 --- a/src/Console/CommandArgs.php +++ b/src/Console/CommandArgs.php @@ -9,7 +9,11 @@ class CommandArgs { } public function getArgs(): array { - return $this->args; + return array_slice($this->args, 2); + } + + public function getArgCount(): int { + return count($this->args) - 2; } public function getCommand(): string { diff --git a/src/Console/Commands/NewMigrationCommand.php b/src/Console/Commands/NewMigrationCommand.php index 385709f6..f7c5d707 100644 --- a/src/Console/Commands/NewMigrationCommand.php +++ b/src/Console/Commands/NewMigrationCommand.php @@ -33,7 +33,7 @@ MIG; } public function dispatch(CommandArgs $args): void { - $name = trim($args->getArg(0)); + $name = str_replace(' ', '_', implode(' ', $args->getArgs())); if(empty($name)) { echo 'Specify a migration name.' . PHP_EOL;