Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Kleinschmidt committed Sep 2, 2019
1 parent 41c95b8 commit 7cec688
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
# WIP: Kirby Terminal
# Kirby Terminal
Manage background processes from the panel. Define scripts like you might already be familiar with from `npm`. Start or stop predefined scripts and monitor the output directly in the panel.

### Scripts
You can define almost any scripts you would normally run from a terminal. A script can be defined as a simple string or if you need more control you can define your script as a callback. The callback is expected to return either a `string` or a `Script` object. The closure of the callback is bound to the scripts section model.
![Terminal Preview](http://github.kleinschmidt.at/kirby-terminal/preview.gif)

## Installation

### Download
Download and copy this repository to `/site/plugins/terminal`.

### Git submodule
```
git submodule add https://github.com/lukaskleinschmidt/kirby-terminal.git site/plugins/terminal
```

### Composer
```
composer require lukaskleinschmidt/kirby-terminal
```

## Define Scripts
You are able to run almost any scripts or commands you would normally run from a terminal. A script can be defined as a simple string or if you need more control you can define your script as a callback. The callback is expected to return either a `string` or a `Script` object. The closure of the callback is bound to the scripts section model.

```php
<?php
Expand Down Expand Up @@ -58,7 +76,7 @@ return [
];
```

### Gate
## Permissions
You may want to restrict access to some scripts. You can do this by adding a gate callback to your config file. The callback is expected to return either `true` or `false`. Within the callback you have access to the authenticated user. In addition the closure is bound to the section object allowing you to make more fine grained decisions. The following two examples will help you getting started.

```php
Expand Down Expand Up @@ -98,7 +116,7 @@ return [
];
```

### Endpoint
## Endpoint
You can change the used API endpoint if you run into any conflicts.

```php
Expand Down Expand Up @@ -159,3 +177,11 @@ confirm:
en: Are you sure you are ready for this?
de: Bist du sicher, dass du bereit bist?
```

## License

MIT

## Credits

- [Lukas Kleinschmidt](https://github.com/lukaskleinschmidt)
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "lukaskleinschmidt/terminal",
"name": "lukaskleinschmidt/kirby-terminal",
"description": "",
"type": "kirby-plugin",
"license": "MIT",
"authors": [
{
"name": "Lukas Kleinschmidt",
"email": "[email protected]"
"email": "[email protected]"
}
],
"require": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
$terminal = function () use ($kirby) {
$terminal = terminal($this->script(), $this->model());

if ($this->gate !== true) {
if ($this->gate() !== true) {
throw new PermissionException;
}

Expand Down

0 comments on commit 7cec688

Please sign in to comment.