chronic
Chronic
Chronic is a natural language date-time parser for the command-line.
Dependencies
- Crystal
- date (for date input formats)
Installation
make install
Editor integration
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:
echo today | chronic
# 2020-02-02 19:00:00
Increment a day:
echo 2020-02-02 + tomorrow | chronic '%F'
# 2020-02-03
Same with --input
option:
echo 2020-02-02 | chronic '%F' --input '%s + tomorrow'
# 2020-02-03
Create a new diary:
echo 01 January to 31 December | chronic '# %F' > ~/documents/diary/2020.md
~/documents/diary/2020.md
# 2020-01-01
[…]
# 2020-12-31
Grep things to do over the next 7 days:
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:
echo Tomorrow 09:00 AM | chronic --sleep
mpv -shuffle ~/music
Configuration
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
Repository
chronic
Owner
Statistic
- 16
- 1
- 0
- 0
- 0
- over 3 years ago
- March 19, 2018
License
The Unlicense
Links
Synced at
Sun, 22 Dec 2024 07:56:40 GMT
Languages