Skip to content

Commit 05de465

Browse files
Accept both draft.yaml and draft.yml file (#159)
1 parent d15b5de commit 05de465

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/Commands/BlueprintCommand.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class BlueprintCommand extends Command
1616
*
1717
* @var string
1818
*/
19-
protected $signature = 'blueprint:build {draft=draft.yaml}';
19+
protected $signature = 'blueprint:build {draft?}';
2020

2121
/**
2222
* The console command description.
@@ -46,7 +46,8 @@ public function __construct(Filesystem $files)
4646
*/
4747
public function handle()
4848
{
49-
$file = $this->argument('draft');
49+
$file = $this->argument('draft') ?? $this->defaultDraftFile();
50+
5051
if (!file_exists($file)) {
5152
$this->error('Draft file could not be found: ' . $file);
5253
}
@@ -96,4 +97,17 @@ private function outputStyle($action)
9697

9798
return 'info';
9899
}
100+
101+
private function defaultDraftFile()
102+
{
103+
if (file_exists('draft.yaml')) {
104+
return 'draft.yaml';
105+
}
106+
107+
if (file_exists('draft.yml')) {
108+
return 'draft.yml';
109+
}
110+
111+
return null;
112+
}
99113
}

0 commit comments

Comments
 (0)