- Added alias functions to all bin scripts using first-letter pattern (e.g., `av` for `activate-venv`, `cwl` for `commit-with-llm`) - Implemented collision resolution by extending aliases with additional letters when conflicts occur or when shadowing standard shell commands - Documented alias implementation approach in library.md with complete alias map for reference - Verified shell syntax with `bash -n` and ensured proper argument passing with `"$@"` - Updated prompt frontmatter to reflect completed state and model used (infomaniak/moonshotai/Kimi-K2.6)
31 lines
1.2 KiB
Bash
Executable File
31 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
download-git-folder() {
|
|
if [[ -z "$1" ]]; then
|
|
echo '$1/path is empty.'
|
|
exit
|
|
fi
|
|
|
|
local git_folders=$(ls-git-folder "$1")
|
|
for git_folder in $git_folders; do
|
|
local git_folder_path=$(git config --file .gitmodules --get submodule."$git_folder".path)
|
|
local git_folder_url=$(git config --file .gitmodules --get submodule."$git_folder".url)
|
|
local git_folder_branch=$(git config --file .gitmodules --get submodule."$git_folder".branch)
|
|
|
|
# Convert git url to http url.
|
|
git_folder_url="$(echo $git_folder_url | sed 's|git@|https://|g' | sed 's|m:|m/|g' | sed 's|\.git||g')"
|
|
|
|
# Get commit ref from .gitmodules
|
|
local commit_ref=$(git config --file .gitmodules --get submodule."$git_folder".commit)
|
|
echo "Download $git_folder_url to $git_folder_path."
|
|
mkdir -p "$git_folder_path"
|
|
curl -L -o "$git_folder_path/archive.tar.gz" \
|
|
"$git_folder_url/archive/$commit_ref.tar.gz"
|
|
echo "Extract and delete $git_folder_path/archive.tar.gz"
|
|
tar -xzf "$git_folder_path/archive.tar.gz" --strip-components=1 -C "$git_folder_path"
|
|
rm "$git_folder_path/archive.tar.gz"
|
|
done
|
|
}
|
|
dgf() {
|
|
download-git-folder "$@"
|
|
}
|