[script] update log_editor.sh

This commit is contained in:
Mathieu Maret 2011-10-03 09:45:55 +02:00
parent daa9f0ad0c
commit 95c9893c00

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
log_directory=~/log log_directory=~/log
log_sample="Lundi:\n log_sample="\nLundi:\n
\n \n
Mardi:\n Mardi:\n
\n \n
@ -10,13 +10,18 @@ Mercredi:\n
Jeudi:\n Jeudi:\n
\n \n
Vendredi:\n Vendredi:\n
\n
\n
\n
\n
TODO:\n
" "
SPM=60 SPM=60
MPH=60 MPH=60
HPD=24 HPD=24
mode_available="view edit list toMail" mode_available="view edit list toMail todo"
usage () { usage () {
echo "usage : ${0##*/} MODE [DATE|select] " echo "usage : ${0##*/} MODE [DATE|select] "
@ -87,7 +92,7 @@ edit () {
list () { list () {
logs=$(ls $log_directory | sort -r ) logs=$(ls $log_directory | grep ".*_.*_.*"| sort -r )
echo "${logs}" echo "${logs}"
} }
@ -97,12 +102,15 @@ toMail () {
curr_day=$(date --date="$date_arg days ago" +%u) curr_day=$(date --date="$date_arg days ago" +%u)
day_to_monday=$(($curr_day -1)) day_to_monday=$(($curr_day -1))
day_to_friday=$((5 - $curr_day)) day_to_friday=$((5 - $curr_day))
start_date=$(date --date="$((date_arg + day_to_monday)) days ago" +%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) stop_date=$(date --date="$((date_arg + day_to_friday)) days" +%Y-%m-%d)
echo "Weekly $start_date -> $stop_date" echo "Weekly $start_date -> $stop_date"
view view $1
} }
todo () {
${EDITOR} $log_directory/TODO
}
check_valid_argument $1 "$mode_available" check_valid_argument $1 "$mode_available"
valid=$? valid=$?