Skip to content

Commit

Permalink
make changes from feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew-Daniels committed Oct 21, 2023
1 parent abaadba commit 93496b6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions segments/gcalcli.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Print next Google Calendar Event

TMUX_POWERLINE_SEG_GCALCLI_MILITARY_TIME_DEFAULT=1
TMUX_POWERLINE_SEG_GCALCLI_24HR_TIME_FORMAT_DEFAULT=1

generate_segmentrc() {
read -d '' rccontents << EORC
gcalcli uses military time by default - if you want to see 12 hour time format, set TMUX_POWERLINE_SEG_GCALCLI_MILITARY_TIME_DEFAULT to 0
export TMUX_POWERLINE_SEG_GCALCLI_MILITARY_TIME="${TMUX_POWERLINE_SEG_GCALCLI_MILITARY_TIME_DEFAULT}"
# gcalcli uses 24hr time format by default - if you want to see 12hr time format, set TMUX_POWERLINE_SEG_GCALCLI_MILITARY_TIME_DEFAULT to 0
export TMUX_POWERLINE_SEG_GCALCLI_24HR_TIME_FORMAT="${TMUX_POWERLINE_SEG_GCALCLI_24HR_TIME_FORMAT_DEFAULT}"
EORC
echo "$rccontents"
}

__process_settings() {
if [ -z "$TMUX_POWERLINE_SEG_GCALCLI_MILITARY_TIME" ]; then
export TMUX_POWERLINE_SEG_GCALCLI_MILITARY_TIME="${TMUX_POWERLINE_SEG_GCALCLI_MILITARY_TIME_DEFAULT}"
if [ -z "$TMUX_POWERLINE_SEG_GCALCLI_24HR_TIME_FORMAT" ]; then
export TMUX_POWERLINE_SEG_GCALCLI_24HR_TIME_FORMAT="${TMUX_POWERLINE_SEG_GCALCLI_24HR_TIME_FORMAT_DEFAULT}"
fi
}

Expand All @@ -24,7 +24,7 @@ run_segment() {
fi
__process_settings
gcmd=(gcalcli agenda)
if [[ $TMUX_POWERLINE_SEG_GCALCLI_MILITARY_TIME == 0 ]]; then
if [[ $TMUX_POWERLINE_SEG_GCALCLI_24HR_TIME_FORMAT == 0 ]]; then
gcmd+=(--no-military)
fi
"${gcmd[@]}" | head -2 | tail -1 | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' | sed -E 's/ +/ /g'
Expand Down

0 comments on commit 93496b6

Please sign in to comment.