From b3e782d7160d8c5f6ee0b7b4a1b35b1219932cd9 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 5 Oct 2024 12:07:34 +0200 Subject: [PATCH] home/git: add tmcommit script --- home/programs/git/default.nix | 8 ++++++++ home/programs/git/scripts/git-tcommit.sh | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/home/programs/git/default.nix b/home/programs/git/default.nix index 56a37a2..716c4bc 100644 --- a/home/programs/git/default.nix +++ b/home/programs/git/default.nix @@ -262,6 +262,14 @@ in runtimeInputs = with pkgs; [ cfg.package coreutils ]; text = lib.fileContents ./scripts/git-tcommit.sh; }) + (pkgs.writeShellApplication { + name = "git-tmcommit"; + runtimeInputs = with pkgs; [ cfg.package coreutils ]; + text = lib.pipe ./scripts/git-tcommit.sh [ + lib.fileContents + (builtins.replaceStrings ["hours" "tcommit"] ["minutes" "tmcommit"]) + ]; + }) (pkgs.writeShellApplication { name = "git-switch-interactive"; runtimeInputs = with pkgs; [ cfg.package fzf gnused coreutils ]; diff --git a/home/programs/git/scripts/git-tcommit.sh b/home/programs/git/scripts/git-tcommit.sh index 991343d..e60dce6 100755 --- a/home/programs/git/scripts/git-tcommit.sh +++ b/home/programs/git/scripts/git-tcommit.sh @@ -1,5 +1,10 @@ set -euo pipefail +if [[ $# -lt 1 ]]; then + echo "Usage: git tcommit [-]" + exit 1 +fi + HOUR_SHIFT="$1" shift