- Introduce new git folder management functions: `clean-git-folder`, `commit-git-folder`, `ls-git-folder`, `push-git-folder`, `reset-git-folder`, `stage-git-folder`, `status-git-folder` - Add `.prompt/update-switch-case-for-all-task-files` script to update task files with comma-separated command support - Enhance task command parsing to support comma-separated commands with whitespace trimming and error handling - Document all new git folder functions in `library.md` under Git section - Add all new git folder functions to help table in `task.template` - Update `library.md` to include folder structure overview and fix typos - Maintain consistent formatting and structure with existing code
23 lines
773 B
Bash
Executable File
23 lines
773 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
ls-git-folder() {
|
|
[[ -z "$1" ]] && { echo '$1 is empty.' >&2; return 1; }
|
|
[[ ! -d "$1" ]] && { echo "Error: '$1' is not a directory." >&2; return 1; }
|
|
|
|
local excludes="${GIT_FOLDER_EXCLUDE:-.cache,node_modules,venv,__pycache__,.vim,.fzf,.password-store,.oh-my-zsh}"
|
|
local find_cmd="find \"$1\" -maxdepth 3"
|
|
|
|
IFS=',' read -ra patterns <<< "$excludes"
|
|
for pattern in "${patterns[@]}"; do
|
|
pattern=$(echo "$pattern" | xargs)
|
|
[[ -n "$pattern" ]] && find_cmd="$find_cmd \( -name '$pattern' -o -path \"*/$pattern/*\" \) -prune -o"
|
|
done
|
|
|
|
find_cmd="$find_cmd -type d -name '.git' -print"
|
|
|
|
eval "$find_cmd" 2>/dev/null | while IFS= read -r git_dir; do
|
|
dirname "$git_dir"
|
|
done
|
|
} |