Files
.dotfiles/linux/lib/rc_lib

56 lines
1.4 KiB
Plaintext

load_all_env() {
local env_dir="$HOME/.env"
if [ -d "$env_dir" ]; then
for env_file in "$env_dir"/*; do
if [ -f "$env_file" ] && [ -r "$env_file" ]; then
echo "Loading: $env_file"
set -a
source "$env_file"
set +a
fi
done
echo "All environment files loaded from $env_dir"
else
echo "Env directory not found: $env_dir"
fi
}
load_all_env
ginit() {
git init --initial-branch=main
git remote add origin $1
git add .
git commit -m "Initial commit"
git push --set-upstream origin main
}
gpush() {
if [ -f "$PWD/.gitcommit.txt" ]; then
local commit="$(tail -n 1 .gitcommit.txt)"
local branch="$(git branch --show-current 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null)"
git add .
git commit -m "$commit"
git push origin "$branch"
else
echo "file no"
fi
}
myalias() {
local RED=$(tput setaf 1)
local GREEN=$(tput setaf 2)
local normal=$(tput sgr0)
echo " My custom aliases:"
echo " Alias Command"
echo "--------------------- ---------------------------------"
grep "^alias " ~/.dotfiles/linux/lib/alias_lib | \
sed 's/^alias //;s/="/ /;s/"$//' | \
sort | \
while read -r key command; do
printf " ${RED}%-20s${normal} ${GREEN}%s${normal}\n" "$key" "$command"
done
}