Skip to content

Commit

Permalink
refactor(#39): rewrite zsh wttr.in wrappers in posix shell
Browse files Browse the repository at this point in the history
  • Loading branch information
meatwallace committed May 23, 2019
1 parent c2ddcd7 commit 294a49e
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 48 deletions.
7 changes: 0 additions & 7 deletions .zfuncs/forecast

This file was deleted.

14 changes: 5 additions & 9 deletions .zfuncs/pomo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env zsh
#!/usr/bin/zsh

set -euo pipefail
set -uo pipefail

function usage() {
cat << HEREDOC
Expand Down Expand Up @@ -75,7 +75,7 @@ function pomo_help() {

function pomo_timer() {
local -i minutes=$1
local message=${2:-get it done.}
local message=${2:-${message[${state[working]}}}

# timer takes minutes, but we want to convert it to seconds
local -i duration
Expand All @@ -101,17 +101,13 @@ function pomo_start() {
local -i short_break_duration
local -i long_break_duration

# TODO: calculate and print total session time when complete
local -i session_start_time
local -i block_start_time
local -i pomodoro_count
local timer_state

# set our initial/default values
pomodoro_duration=25
short_break_duration=5
long_break_duration=15
session_start_time=$(date +%s)
pomodoro_count=0
timer_state=${state[working]}

Expand All @@ -125,10 +121,10 @@ function pomo_start() {
esac
done

clear
printf "%s\n\n" "pomo"

while true; do
block_start_time=$(date +%s)
pomo_notify ${title[$timer_state]} ${message[$timer_state]} ${icon[$timer_state]}

printf "%s\n\n" "streak: $pomodoro_count"
Expand Down Expand Up @@ -158,7 +154,7 @@ function pomo_start() {

*)
echo "impossible state"
exit 1 ;;
break ;;
esac

printf "\r\033[2A\033[K"
Expand Down
11 changes: 0 additions & 11 deletions .zfuncs/weather

This file was deleted.

2 changes: 1 addition & 1 deletion bin/blue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -eu
set -e

usage() {
cat << HEREDOC
Expand Down
Empty file modified bin/forecast
100644 → 100755
Empty file.
5 changes: 2 additions & 3 deletions bin/shellcheck
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
set -eu

shellcheck() {
docker run -it --rm \
docker run -it --rm --name="shellcheck" \
--volume "$PWD:/mnt" \
--name shellcheck \
koalaman/shellcheck "$@"
koalaman/shellcheck:latest "$@"
}

shellcheck "$@"
5 changes: 2 additions & 3 deletions bin/shfmt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
set -eu

shfmt() {
docker run -it --rm \
docker run -it --rm --name="shfmt" \
--volume "$PWD:/work" \
--name shfmt \
tmknom/shfmt -i 2 "$@"
tmknom/shfmt:latest -i 2 "$@"
}

shfmt "$@"
14 changes: 0 additions & 14 deletions bin/tiz

This file was deleted.

0 comments on commit 294a49e

Please sign in to comment.