Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
erikaheidi committed Nov 2, 2022
0 parents commit ca02ffd
Show file tree
Hide file tree
Showing 16 changed files with 3,224 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
.phpunit.result.cache
.composer/
vendor/
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM minicli/php81

# Install Composer and set up application
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

RUN mkdir /application && chown -R php /application
COPY . /application/
RUN cd /application && composer install

ENTRYPOINT [ "php", "/application/minicli" ]
CMD ["help"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Minicli GitHub Action Template

This repository is an application template for building GitHub Actions 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.
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# action.yml
name: 'GitHub Action Template'
description: 'A template repository for building GitHub actions in PHP with Minicli'
outputs:
response:
description: 'Output from command'
runs:
using: 'docker'
image: 'Dockerfile'
1 change: 1 addition & 0 deletions app/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.
14 changes: 14 additions & 0 deletions app/Command/Demo/DefaultController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

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.');
}
}
26 changes: 26 additions & 0 deletions app/Command/Demo/TableController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Command\Demo;

use Minicli\Command\CommandController;
use Minicli\Output\Filter\ColorOutputFilter;
use Minicli\Output\Helper\TableHelper;

class TableController extends CommandController
{
public function handle(): void
{
$this->getPrinter()->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"]);
}

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

namespace App\Command\Demo;

use Minicli\Command\CommandController;

class TestController extends CommandController
{
public function handle(): void
{
$name = $this->hasParam('user') ? $this->getParam('user') : 'World';
$this->getPrinter()->display(sprintf("Hello, %s!", $name));

print_r($this->getParams());
}
}
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "minicli/github-action",
"description": "Minicli GitHub Action Application Template",
"license": "MIT",
"homepage": "https://github.com/minicli/application",
"keywords": ["action", "github", "command-line", "template"],
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"require": {
"minicli/minicli": "^3.0",
"minicli/command-help": "^0.1.0"
},
"require-dev": {
"pestphp/pest": "^1.21"
},
"scripts": {
"test" : ["pest"]
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
Loading

0 comments on commit ca02ffd

Please sign in to comment.