feat(shell): add p3 alias and remove auto-commit from gitignore()
- Add `p3 = "python3";` to `programs.bash.shellAliases` in `home/shell.nix` for quick Python 3 invocation - Remove automatic `git add`, `git commit`, and `git push` from `gitignore()` in `home/shell/git.sh` so it only appends new patterns to `.gitignore`
This commit is contained in:
1 parent
1f3c1a7d18
commit
a6afe699fb
2 files changed
+3
-12
No files matched your search
@@ -240,6 +240,7 @@ in
|
|||||||
check = "~/Config/scripts/test";
|
check = "~/Config/scripts/test";
|
||||||
nfc = "nix flake check -L";
|
nfc = "nix flake check -L";
|
||||||
ff = "fastfetch --logo none";
|
ff = "fastfetch --logo none";
|
||||||
|
p3 = "python3";
|
||||||
|
|
||||||
# System Navigation
|
# System Navigation
|
||||||
".." = "cd ..";
|
".." = "cd ..";
|
||||||
|
|||||||
+2
-12
@@ -2,8 +2,7 @@
|
|||||||
# 🌟 Custom Git Automation & Helper Utilities
|
# 🌟 Custom Git Automation & Helper Utilities
|
||||||
# Sourced in .bashrc to streamline gitignore modifications, commit-push workflows, and new repo setups.
|
# Sourced in .bashrc to streamline gitignore modifications, commit-push workflows, and new repo setups.
|
||||||
|
|
||||||
# 1. gitignore: Quickly appends patterns to the repository's root .gitignore file
|
# 1. gitignore: Quickly appends patterns to the repository's root .gitignore file.
|
||||||
# then automatically commits and pushes the change.
|
|
||||||
gitignore() {
|
gitignore() {
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "Usage: gitignore <pattern> [pattern...]"
|
echo "Usage: gitignore <pattern> [pattern...]"
|
||||||
@@ -30,7 +29,6 @@ gitignore() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local added_count=0
|
local added_count=0
|
||||||
local commit_msg_list=""
|
|
||||||
|
|
||||||
for pattern in "$@"; do
|
for pattern in "$@"; do
|
||||||
# Check if the pattern is already present in the .gitignore file
|
# Check if the pattern is already present in the .gitignore file
|
||||||
@@ -40,18 +38,10 @@ gitignore() {
|
|||||||
echo "$pattern" >> "$GIT_IGNORE_FILE"
|
echo "$pattern" >> "$GIT_IGNORE_FILE"
|
||||||
echo "Added '$pattern'"
|
echo "Added '$pattern'"
|
||||||
((added_count++))
|
((added_count++))
|
||||||
commit_msg_list+="${pattern}, "
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If any patterns were added, commit and push them automatically
|
if [ "$added_count" -eq 0 ]; then
|
||||||
if [ $added_count -gt 0 ]; then
|
|
||||||
commit_msg_list="${commit_msg_list%, }"
|
|
||||||
echo "Committing and pushing changes..."
|
|
||||||
git add "$GIT_IGNORE_FILE"
|
|
||||||
git commit -m "Add to .gitignore: $commit_msg_list"
|
|
||||||
git push
|
|
||||||
else
|
|
||||||
echo "No new patterns were added."
|
echo "No new patterns were added."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user