Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,35 @@ Lint cron files. Based on the work of @Dave13h from https://github.com/Dave13h/p

# Installation

```composer require --dev jpi/cron-linter```
```bash
composer require --dev jpi/cron-linter
```

Add `.cronlinter.yml` file to your project root, that provides a list of files to be linted.
Add a `.cronlinter.yml` file to your project root that specifies a list of cron files to lint.

```yml
files:
- /cron-1
- /cron-2
```
Then run `php vendor/bin/lintcron`, it should then list any errors found in the specified cron files. You can have different config file location using the `--config` option.

You can also specify files to be linted using the `--files` option, providing a comma separated list of file paths.
Then run `php vendor/bin/lintcron`, which will list any errors found in the specified cron files. You can use a different config file location using the `--config-file` option.

You can also specify files to be linted using the `--files` option, providing a comma-separated list of file paths.

Or if you want to do it programmatically on files or content.

```php
// $files is an array of file paths for cron's to check, $baseDir (optional) is a string containing the base directory path for all paths
// Lint cron files
// $files is an array of file paths for cron files to check
// $baseDir (optional) is a string containing the base directory path for all file paths
$errors = \JPI\CronLinter::lintFiles($files, $baseDir);

// $expression is a string containing the cron expression(s)
// Lint cron content directly
// $expression is a string containing one or more cron expressions (one per line)
$errors = \JPI\CronLinter::lintContent($expression);

// Both return an array of errors found, empty array if no errors found.
// Both methods return an array of error messages, or an empty array if no errors found
```

## Support
Expand All @@ -48,4 +54,4 @@ If you find any issues or have any feature requests, you can open a [issue](http

## Licence

This module is licenced under the General Public Licence - see the [licence](LICENSE.md) file for details
This module is licenced under the GNU General Public Licence - see the [licence](LICENSE.md) file for details
2 changes: 1 addition & 1 deletion src/CronLinter/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function configure(): void
"files",
null,
InputOption::VALUE_OPTIONAL,
"Comma seperated list of cron files to check"
"Comma separated list of cron files to check"
)
;
}
Expand Down