From 95c9893c003c952e532df1ee028fd76b6f8184be Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Mon, 3 Oct 2011 09:45:55 +0200 Subject: [PATCH] [script] update log_editor.sh --- scripts/log_editor.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/log_editor.sh b/scripts/log_editor.sh index 3ea992b..2d7fb44 100755 --- a/scripts/log_editor.sh +++ b/scripts/log_editor.sh @@ -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=$?