git-time-keeper
git-time-keeper
is a tool that helps to take baby steps 👶🦶
Setup
With git-gamble
# git config --local core.hooksPath ./hooks # if you want to versionate hooks
HOOKS_PATH=$(git rev-parse --git-path hooks)
mkdir -p "$HOOKS_PATH"
echo "git-time-keeper 'stop'" >>"$HOOKS_PATH/pre-gamble"
echo "git-time-keeper 'start' 'git-gamble --pass'" >>"$HOOKS_PATH/post-gamble"
chmod +x "$HOOKS_PATH"/{pre,post}-gamble
With git
Without git-gamble
# git config --local core.hooksPath ./hooks # if you want to versionate hooks
HOOKS_PATH=$(git rev-parse --git-path hooks)
mkdir -p "$HOOKS_PATH"
echo "git-time-keeper 'stop'" >>"$HOOKS_PATH/pre-commit"
echo "git-time-keeper 'start'" >>"$HOOKS_PATH/post-commit"
chmod +x "$HOOKS_PATH"/{pre,post}-commit
Set iteration duration
export TIME_KEEPER_MAXIMUM_ITERATION_DURATION=$((3 * 60)) # 3 minutes
How to use ?
When being on time
sequenceDiagram actor Dev participant git participant hooks participant git-time-keeper Dev->>git: git commit git->>hooks: git hook run pre-commit hooks-xgit-time-keeper: git time-keeper stop git->>hooks: git hook run post-commit hooks-)+git-time-keeper: git time-keeper start Dev->>git: git commit git->>hooks: git hook run pre-commit hooks-)git-time-keeper: git time-keeper stop git-time-keeper-->-hooks: timer stopped git->>hooks: git hook run post-commit hooks-xgit-time-keeper: git time-keeper start
When the countdown is missed
sequenceDiagram actor Dev participant git participant hooks participant git-time-keeper Dev->>git: git commit git->>hooks: git hook run pre-commit hooks-xgit-time-keeper: git time-keeper stop git->>hooks: git hook run post-commit hooks-)+git-time-keeper: git time-keeper start git-time-keeper-)git-time-keeper: time limit passed git-time-keeper-)-git: git restore .
To see all available flags and options
git-time-keeper --help # dash between `git` and `time-keeper` is only needed for --help
Usage
git-time-keeper --help
Usage: git-time-keeper [OPTIONS]
Options:
-h, --help Print help
-V, --version Print version
Any contributions (feedback, bug report, merge request ...) are welcome
https://gitlab.com/pinage404/git-gamble
Possible states
stateDiagram state "Timer is running" as running state "git restore ." as clean [*] --> running : start running --> [*] : stop running --> clean : time limit passed clean --> [*] running --> running : start [*] --> [*] : stop
Limitation
Unix compatible only (Linux / Mac OS X) : need sh
and kill