Skip to content

Commit 11cc3ee

Browse files
committed
Updating to latest Minicli
1 parent 2bc4164 commit 11cc3ee

File tree

3 files changed

+101
-93
lines changed

3 files changed

+101
-93
lines changed

Command/Create/ContentController.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@
22

33
namespace librarianphp\Create;
44

5+
use Minicli\FileNotFoundException;
56
use Minicli\Stencil;
67
use Minicli\Command\CommandController;
78
use Minicli\Input;
89

910
class ContentController extends CommandController
1011
{
12+
/**
13+
* @throws FileNotFoundException
14+
*/
1115
public function handle(): void
1216
{
1317
if (!$this->getApp()->config->has('stencil_dir')) {
14-
$this->getApp()->getPrinter()->error("You must define a stencil_dir config option.");
18+
$this->error("You must define a stencil_dir config option.");
1519
return;
1620
}
1721

1822
if (!$this->getApp()->config->has('stencil_locations')) {
19-
$this->getApp()->getPrinter()->error("You must define a stencil_locations array config option.");
23+
$this->error("You must define a stencil_locations array config option.");
2024
return;
2125
}
2226

@@ -30,10 +34,10 @@ public function handle(): void
3034

3135
$input = new Input(' ');
3236

33-
$this->getPrinter()->info("Content Title: ");
37+
$this->info("Content Title: ");
3438
$title = $input->read();
3539

36-
$this->getPrinter()->info("Content Description: ");
40+
$this->info("Content Description: ");
3741
$description = $input->read();
3842

3943
$content = $stencil->applyTemplate($template_name, [
@@ -44,7 +48,7 @@ public function handle(): void
4448
$save_locations = $this->getApp()->config->stencil_locations;
4549

4650
if (!array_key_exists($template_name, $save_locations)) {
47-
$this->getPrinter()->error("Save location not found for template $template_name");
51+
$this->error("Save location not found for template $template_name");
4852
return;
4953
}
5054

@@ -53,7 +57,7 @@ public function handle(): void
5357
$file = fopen($path . '/' . $save_name, 'a+');
5458

5559
fwrite($file, $content);
56-
$this->getPrinter()->info("Content generated at " . $path . '/' . $save_name);
60+
$this->info("Content generated at " . $path . '/' . $save_name);
5761
}
5862

5963
public function slugify($title)

Command/Create/DefaultController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class DefaultController extends CommandController
99
{
1010
public function handle(): void
1111
{
12-
$this->getPrinter()->info("./librarian create [subcommand]", true);
13-
$this->getPrinter()->info("Run \"./librarian create content\" to create a content file based on a template.");
12+
$this->info("./librarian create [subcommand]", true);
13+
$this->info("Run \"./librarian create content\" to create a content file based on a template.");
1414
}
1515
}

0 commit comments

Comments
 (0)