https://github.com/ryuheechul/cron-parser-rust
A practice of attempting to parse crontab expressions with Rust
https://github.com/ryuheechul/cron-parser-rust
Last synced: 11 months ago
JSON representation
A practice of attempting to parse crontab expressions with Rust
- Host: GitHub
- URL: https://github.com/ryuheechul/cron-parser-rust
- Owner: ryuheechul
- Created: 2021-01-23T20:46:46.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-23T21:10:09.000Z (over 5 years ago)
- Last Synced: 2025-07-10T21:01:57.619Z (12 months ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cron-parser
It's just a practice of attempting to parse crontab expressions with Rust
## Prerequisites
### Install Rust
https://www.rust-lang.org/tools/install
### Install Docker (optional)
https://docs.docker.com/engine/install
## With Docker
### Build
`make build`
### Test
`make test`
### Run
`make run`
[docker-compose.yaml](./docker-compose.yaml) already provides example argument
## With Cargo
### Fast run
`cargo run "*/15 0 1,15 * 1-5 /usr/bin/find"`
### Format
`cargo fmt`
### Test
`cargo test`
### Build
`cargo build [--release]`
### Run
`target/[debug|release]/cron-parser "*/15 0 1,15 * 1-5 /usr/bin/find"`
## Caveats
Apparently something like this `1,2-5/3,4,*` is also valid according to [crontab.guru](https://crontab.guru/#1_1,2-5/3,4,*_2-3_4/5_6,7).
But this code is made with assumption that only one of `,`, `-`, `/` are used at once for each slot which colud be updated to reflect that later.