Skip to content

Commit

Permalink
Merge pull request #6 from minicli/dx-improvements
Browse files Browse the repository at this point in the history
DX Improvements
  • Loading branch information
erikaheidi authored May 19, 2023
2 parents 144df4c + 885da93 commit 78489fb
Show file tree
Hide file tree
Showing 15 changed files with 389 additions and 595 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml,json}]
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/art export-ignore
5 changes: 4 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Check code style
run: composer test:lint

- name: Run test suite
run: composer run-script test
run: composer test:unit
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Minicli Application Template
<div align="center">
<p>
<img src="https://github.com/minicli/application/raw/main/art/minicli.png" alt="Minicli" width="150"/>
<h1>Minicli Application Template</h1>
</p>
</div>
<hr>

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

Please check [the official documentation](https://docs.minicli.dev) for more information on how to use this application template.
Please check [the official documentation](https://docs.minicli.dev) for more information on how to use this application template.
7 changes: 4 additions & 3 deletions app/Command/Demo/DefaultController.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

declare(strict_types=1);

namespace App\Command\Demo;

use Minicli\App;
use Minicli\Command\CommandController;

class DefaultController extends CommandController
{
public function handle(): void
{
$this->getPrinter()->info('Run ./minicli help for usage help.');
$this->info('Run ./minicli help for usage help.');
}
}
}
14 changes: 8 additions & 6 deletions app/Command/Demo/TableController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Command\Demo;

use Minicli\Command\CommandController;
Expand All @@ -10,17 +12,17 @@ class TableController extends CommandController
{
public function handle(): void
{
$this->getPrinter()->display('Testing Tables');
$this->display('Testing Tables');

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

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

$this->getPrinter()->newline();
$this->getPrinter()->rawOutput($table->getFormattedTable(new ColorOutputFilter()));
$this->getPrinter()->newline();
$this->newline();
$this->rawOutput($table->getFormattedTable(new ColorOutputFilter()));
$this->newline();
}
}
}
6 changes: 4 additions & 2 deletions app/Command/Demo/TestController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Command\Demo;

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

print_r($this->getParams());
}
}
}
Binary file added art/minicli.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@
}
},
"require": {
"minicli/minicli": "^3.0",
"minicli/command-help": "^0.1.0"
"php": ">=8.1",
"minicli/minicli": "^4.0",
"minicli/command-help": "^1.0"
},
"require-dev": {
"pestphp/pest": "^1.21"
"pestphp/pest": "^1.21",
"laravel/pint": "^1.10"
},
"scripts": {
"test" : ["pest"]
"lint" : ["pint"],
"test:lint" : ["pint --test"],
"test:unit" : ["pest"],
"test" : [
"@test:lint",
"@test:unit"
]
},
"config": {
"allow-plugins": {
Expand Down
Loading

0 comments on commit 78489fb

Please sign in to comment.