[script] update log_editor.sh
This commit is contained in:
parent
daa9f0ad0c
commit
95c9893c00
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
log_directory=~/log
|
||||
log_sample="Lundi:\n
|
||||
log_sample="\nLundi:\n
|
||||
\n
|
||||
Mardi:\n
|
||||
\n
|
||||
@ -10,13 +10,18 @@ Mercredi:\n
|
||||
Jeudi:\n
|
||||
\n
|
||||
Vendredi:\n
|
||||
\n
|
||||
\n
|
||||
\n
|
||||
\n
|
||||
TODO:\n
|
||||
"
|
||||
|
||||
SPM=60
|
||||
MPH=60
|
||||
HPD=24
|
||||
|
||||
mode_available="view edit list toMail"
|
||||
mode_available="view edit list toMail todo"
|
||||
|
||||
usage () {
|
||||
echo "usage : ${0##*/} MODE [DATE|select] "
|
||||
@ -87,7 +92,7 @@ edit () {
|
||||
|
||||
|
||||
list () {
|
||||
logs=$(ls $log_directory | sort -r )
|
||||
logs=$(ls $log_directory | grep ".*_.*_.*"| sort -r )
|
||||
echo "${logs}"
|
||||
}
|
||||
|
||||
@ -97,12 +102,15 @@ toMail () {
|
||||
curr_day=$(date --date="$date_arg days ago" +%u)
|
||||
day_to_monday=$(($curr_day -1))
|
||||
day_to_friday=$((5 - $curr_day))
|
||||
start_date=$(date --date="$((date_arg + day_to_monday)) days ago" +%y-%m-%d)
|
||||
stop_date=$(date --date="$((date_arg + day_to_friday)) days" +%y-%m-%d)
|
||||
start_date=$(date --date="$((date_arg + day_to_monday)) days ago" +%Y-%m-%d)
|
||||
stop_date=$(date --date="$((date_arg + day_to_friday)) days" +%Y-%m-%d)
|
||||
echo "Weekly $start_date -> $stop_date"
|
||||
view
|
||||
view $1
|
||||
}
|
||||
|
||||
todo () {
|
||||
${EDITOR} $log_directory/TODO
|
||||
}
|
||||
|
||||
check_valid_argument $1 "$mode_available"
|
||||
valid=$?
|
||||
|
Loading…
Reference in New Issue
Block a user