chronic
Version, currently master branch1 version
- master branchlatestAug 24, 2021
github.com/alexherbo2/chronic
A natural language date-time parser for the command-line
18 stars
0 dependents
License: Unlicense
Installation
# Add this to your shard.yml
dependencies:
chronic:
github: alexherbo2/chronic
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
1.0.0- License
- Unlicense
- Target
chronicfrom src/chronic.cr
Dependencies
This version declares no dependencies.
README
# Chronic [](https://webchat.freenode.net/#chronic) <img src="https://github.com/FortAwesome/Font-Awesome/raw/master/svgs/solid/cog.svg" height="16" align="right"> Chronic is a natural language date-time parser for the command-line. [](https://youtube.com/playlist?list=PLdr-HcjEDx_nVgUW8io9HG39BDyp96u3s) [](https://youtube.com/playlist?list=PLdr-HcjEDx_nVgUW8io9HG39BDyp96u3s) ## Dependencies - [Crystal] - [date] (for [date input formats]) ## Installation ``` sh make install ``` ### Editor integration - [Kakoune][chronic.kak] ## Usage ``` [time = now] | chronic [format = %F %T] [--input | -i INPUT] [--days | -d DAYS] [--hours | -h HOURS] [--minutes | -m MINUTES] [--seconds | -s SECONDS] [--format | -f FORMAT] [--separator | -j SEPARATOR] [--sleep | -z] [--command | -x COMMAND] [--help] ``` ### Syntax ``` <time> [+|plus] [relative-time] | chronic [format] <start-time> [..|-|→|to] <end-time> | chronic [format] <time> [::] <relative-time> | chronic [format] ``` ### Examples Simple: ``` sh echo today | chronic # 2020-02-02 19:00:00 ``` Increment a day: ``` sh echo 2020-02-02 + tomorrow | chronic '%F' # 2020-02-03 ``` Same with `--input` option: ``` sh echo 2020-02-02 | chronic '%F' --input '%s + tomorrow' # 2020-02-03 ``` Create a new diary: ``` sh echo 01 January to 31 December | chronic '# %F' > ~/documents/diary/2020.md ``` `~/documents/diary/2020.md` ``` markdown # 2020-01-01 […] # 2020-12-31 ``` Grep things to do over the next 7 days: ``` sh grep $(chronic --input 'today → 7 days' 'TODO.+%F' --separator '|') ``` Regex: ``` TODO.+2020-02-02|TODO.+2020-02-03|TODO.+2020-02-04|TODO.+2020-02-05|TODO.+2020-02-06|TODO.+2020-02-07|TODO.+2020-02-08 ``` Set up an alarm: ``` sh echo Tomorrow 09:00 AM | chronic --sleep mpv -shuffle ~/music ``` ## Configuration ``` sh alias p=echo alias cr=chronic ``` ## Options ``` --input / -i INPUT Set text input (Default: %s). You can map stdin content with %s. --days / -d DAYS Configure step in days (Default: 1). --hours / -h HOURS Configure step in hours. --minutes / -m MINUTES Configure step in minutes. --seconds / -s SECONDS Configure step in seconds. --format / -f FORMAT Set text format (Default: %s). --separator / -j SEPARATOR Configure separator (Default: ). --sleep / -z Sleep for the specified time span. --command / -x COMMAND Execute command when the specified time passed. Requires --sleep. --help Display a help message and quit. ``` ## References - [Time::Format] - [Date input formats] [Crystal]: https://crystal-lang.org [Time::Format]: https://crystal-lang.org/api/Time/Format.html [date]: https://gnu.org/software/coreutils/manual/coreutils.html#date-invocation [Date input formats]: https://gnu.org/software/coreutils/manual/coreutils.html#Date-input-formats [ripgrep]: https://github.com/BurntSushi/ripgrep [chronic.kak]: https://github.com/alexherbo2/chronic.kak
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Aug 24, 2021
- Crystal
1.0.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/alexherbo2/chronic
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 1