From 4dca26d81d9eb4a2b68d99b40d76d3168bf83ce8 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 5 Jul 2025 00:55:02 +0800 Subject: [PATCH] feat(homes/rafiq): make note script auto push --- homes/x86_64-linux/rafiq/cli/utilities/zk.nix | 2 +- packages/commit/default.nix | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/homes/x86_64-linux/rafiq/cli/utilities/zk.nix b/homes/x86_64-linux/rafiq/cli/utilities/zk.nix index f5a4897..7ea3050 100644 --- a/homes/x86_64-linux/rafiq/cli/utilities/zk.nix +++ b/homes/x86_64-linux/rafiq/cli/utilities/zk.nix @@ -11,7 +11,7 @@ zk edit -i pushd ~/notebook > /dev/null git add . - commit + commit -u popd > /dev/null '' ) diff --git a/packages/commit/default.nix b/packages/commit/default.nix index f6d9c1b..f017e1d 100644 --- a/packages/commit/default.nix +++ b/packages/commit/default.nix @@ -6,6 +6,7 @@ pkgs.writeShellScriptBin "commit" # bash PROMPT="Please generate a commit message for this diff." GUIDELINES="1. Use conventional commit syntax, following the context. 2. Cap the commit message at 80 characters, preferably less. You must not go beyond this limit. 3. Do not include backticks. Only generate the raw text. 4. Be as succint as possible. Each commit should be atomic. You may throw a warning if it is not." NUM_ANCESTORS=0 + PUSH=false # Parse arguments while [[ $# -gt 0 ]]; do @@ -14,6 +15,10 @@ pkgs.writeShellScriptBin "commit" # bash NUM_ANCESTORS="$2" shift 2 ;; + --push | -u) + PUSH=true + shift + ;; *) echo "Unrecognised argument: $1. Exiting..." exit 1 @@ -39,6 +44,10 @@ pkgs.writeShellScriptBin "commit" # bash y | yes) git commit -am "$RESPONSE" echo "Committed successfully." + if $PUSH; then + git push + echo "Pushed successfully." + fi exit 0 ;; r | reroll)