Skip to content

Commit

Permalink
🚧 converting from jobs to commands
Browse files Browse the repository at this point in the history
Signed-off-by: bnomei <b@bnomei.com>
  • Loading branch information
bnomei committed Nov 13, 2022
1 parent 0b49b51 commit c5c85b4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -265,26 +265,26 @@ if(F::exists($backup)) {
Supplying parameter to the core CLI functions can be a bit tricky since you need to separate argument key and argument values. It seems easy with one but gets a bit tedious with a dynamic list of parameters and if values contain `space`-chars or quotes. But fret not – Janitor has a helper for that as well.

```php
Kirby\CLI\CLI::command('uuid', '--page', 'page://82h2nkal12ls'); // tests/site/commands/uuid.php
Kirby\CLI\CLI::command('uuid', '--data', 'page://82h2nkal12ls'); // tests/site/commands/uuid.php

janitor()->command('uuid --page page://82h2nkal12ls');
janitor()->command('uuid --data page://82h2nkal12ls');

var_dump(janitor()->data('whistle'));
var_dump(janitor()->data('uuid'));
```

> Remember that using the `janitor()->command($string)`-helper you can call any of your own commands and the core commands as well, not just the ones defined by Janitor.
If you want to work with command strings yourself you can use the following static helper method.

```php
list($name, $args) = Bnomei\Janitor::parseCommand('uuid --page page://82h2nkal12ls');
list($name, $args) = Bnomei\Janitor::parseCommand('uuid --data page://82h2nkal12ls');
Kirby\CLI\CLI::command($name, ...$args);
```


### Webhook with secret

You can not call Janitors api unauthenticated. You either need to use the panel button or you can set a `secret` in your config.php file and call the janitor api URL with that secret.
You can not call Janitors api unauthenticated. You either need to use the panel button or you can set a `secret` in your `site/config/config.php` file and call the janitor api URL with that secret.

**site/config/config.php**
```php
Expand Down

0 comments on commit c5c85b4

Please sign in to comment.