blob: b5f1a8c4b4403ab5dcbe4f6dc4263480b7d529df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/bin/sh
# Adds a line to $sdepdata/once. It is possible to specify a date, which will be
# read by date -d and prepended to the input text.
# -d is a non-portable option of GNU date. On some other systems one can
# accomplish the same with the -j option.
# Usage: sdep-add [date]
# Example: sdep-add "next monday"
sdepdata="${XDG_DATA_HOME:-$HOME/.local/}/sdep"
file="$sdepdata/once"
date=""
[ -n "$1" ] && date=$(date -d "$1" +%Y-%m-%d)
[ -n "$date" ] && printf "$date "
read text
if [ -n "$text" ]; then
printf "${date}\t${text}\n" >> "$file"
else
echo "Event not saved"
fi
|