Skip to content

Commit

Permalink
accepts both vendor/name or vendor name (#110)
Browse files Browse the repository at this point in the history
Co-authored-by: bilogic <>
  • Loading branch information
bilogic authored Aug 23, 2020
1 parent bb5d297 commit c4beef7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Commands/NewPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class NewPackage extends Command
* The name and signature of the console command.
* @var string
*/
protected $signature = 'packager:new {vendor} {name} {--i} {--skeleton=}';
protected $signature = 'packager:new {vendor} {name?} {--i} {--skeleton=}';

/**
* The console command description.
Expand Down Expand Up @@ -62,13 +62,22 @@ public function handle()
// Start the progress bar
$this->startProgressBar(6);

$vendor = $this->argument('vendor');
$name = $this->argument('name');

if (stripos($vendor, "/") > 0) {
$part = explode("/", $vendor);
$vendor = $part[0];
$name = $part[1];
}

// Defining vendor/package, optionally defined interactively
if ($this->option('i')) {
$this->conveyor->vendor($this->ask('What will be the vendor name?', $this->argument('vendor')));
$this->conveyor->package($this->ask('What will be the package name?', $this->argument('name')));
$this->conveyor->vendor($this->ask('What will be the vendor name?', $vendor));
$this->conveyor->package($this->ask('What will be the package name?', $name));
} else {
$this->conveyor->vendor($this->argument('vendor'));
$this->conveyor->package($this->argument('name'));
$this->conveyor->vendor($vendor);
$this->conveyor->package($name);
}

// Start creating the package
Expand Down

0 comments on commit c4beef7

Please sign in to comment.