Skip to content

Commit 78489fb

Browse files
authored
Merge pull request #6 from minicli/dx-improvements
DX Improvements
2 parents 144df4c + 885da93 commit 78489fb

15 files changed

+389
-595
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,json}]
15+
indent_size = 2

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/art export-ignore

.github/workflows/php.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@ jobs:
2929
- name: Install dependencies
3030
run: composer install --prefer-dist --no-progress
3131

32+
- name: Check code style
33+
run: composer test:lint
34+
3235
- name: Run test suite
33-
run: composer run-script test
36+
run: composer test:unit

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
# Minicli Application Template
1+
<div align="center">
2+
<p>
3+
<img src="https://github.com/minicli/application/raw/main/art/minicli.png" alt="Minicli" width="150"/>
4+
<h1>Minicli Application Template</h1>
5+
</p>
6+
</div>
7+
<hr>
28

39
This repository is an application template for building command-line applications in PHP with [Minicli](https://github.com/minicli/minicli).
410

5-
Please check [the official documentation](https://docs.minicli.dev) for more information on how to use this application template.
11+
Please check [the official documentation](https://docs.minicli.dev) for more information on how to use this application template.
+4-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Command\Demo;
46

5-
use Minicli\App;
67
use Minicli\Command\CommandController;
78

89
class DefaultController extends CommandController
910
{
1011
public function handle(): void
1112
{
12-
$this->getPrinter()->info('Run ./minicli help for usage help.');
13+
$this->info('Run ./minicli help for usage help.');
1314
}
14-
}
15+
}

app/Command/Demo/TableController.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Command\Demo;
46

57
use Minicli\Command\CommandController;
@@ -10,17 +12,17 @@ class TableController extends CommandController
1012
{
1113
public function handle(): void
1214
{
13-
$this->getPrinter()->display('Testing Tables');
15+
$this->display('Testing Tables');
1416

1517
$table = new TableHelper();
1618
$table->addHeader(['Header 1', 'Header 2', 'Header 3']);
1719

1820
for($i = 1; $i <= 10; $i++) {
19-
$table->addRow([(string)$i, (string)rand(0, 10), "other string $i"]);
21+
$table->addRow([(string)$i, (string)rand(0, 10), "other string {$i}"]);
2022
}
2123

22-
$this->getPrinter()->newline();
23-
$this->getPrinter()->rawOutput($table->getFormattedTable(new ColorOutputFilter()));
24-
$this->getPrinter()->newline();
24+
$this->newline();
25+
$this->rawOutput($table->getFormattedTable(new ColorOutputFilter()));
26+
$this->newline();
2527
}
26-
}
28+
}

app/Command/Demo/TestController.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Command\Demo;
46

57
use Minicli\Command\CommandController;
@@ -9,8 +11,8 @@ class TestController extends CommandController
911
public function handle(): void
1012
{
1113
$name = $this->hasParam('user') ? $this->getParam('user') : 'World';
12-
$this->getPrinter()->display(sprintf("Hello, %s!", $name));
14+
$this->display(sprintf("Hello, %s!", $name));
1315

1416
print_r($this->getParams());
1517
}
16-
}
18+
}

art/minicli.png

45.8 KB
Loading

composer.json

+12-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@
1010
}
1111
},
1212
"require": {
13-
"minicli/minicli": "^3.0",
14-
"minicli/command-help": "^0.1.0"
13+
"php": ">=8.1",
14+
"minicli/minicli": "^4.0",
15+
"minicli/command-help": "^1.0"
1516
},
1617
"require-dev": {
17-
"pestphp/pest": "^1.21"
18+
"pestphp/pest": "^1.21",
19+
"laravel/pint": "^1.10"
1820
},
1921
"scripts": {
20-
"test" : ["pest"]
22+
"lint" : ["pint"],
23+
"test:lint" : ["pint --test"],
24+
"test:unit" : ["pest"],
25+
"test" : [
26+
"@test:lint",
27+
"@test:unit"
28+
]
2129
},
2230
"config": {
2331
"allow-plugins": {

0 commit comments

Comments
 (0)