Skip to content
This repository has been archived by the owner on Sep 10, 2018. It is now read-only.

Commit

Permalink
Locale based declaration for WEEKSTART.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndySun25 committed Oct 9, 2017
1 parent cf3e15e commit c74aa71
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion git-standup
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,20 @@ if [[ $option_d ]] && [[ $option_d -ne 0 ]] ; then
SINCE="$option_d days ago"
else
## -d flag is not there, go on with the normal processing
## WEEKSTART needs to be declared differently to accommodate locales
WEEKSTART="$( cut -d '-' -f 1 <<< "$option_w" )";
WEEKSTART=${WEEKSTART:="Mon"}
case "$(uname -s)" in
Linux|CYGWIN*|WING32*|MSYS*)
WEEKSTART=${WEEKSTART:=$(date -dmonday +%a)}
;;
Darwin)
WEEKSTART=${WEEKSTART:=$(date -v-monday +&a)}
;;
*)
echo "Unsupported OS!"
exit 1
;;
esac

WEEKEND="$( cut -d '-' -f 2 <<< "$option_w" )";
WEEKEND=${WEEKEND:="Fri"}
Expand Down

0 comments on commit c74aa71

Please sign in to comment.