加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
clean.sh 943 Bytes
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env bash
set -euo pipefail
#
# Functions
#
__usage() {
echo "Usage: $(basename "${BASH_SOURCE[0]}") <Arguments>
Arguments:
<Arguments>... Arguments passed to the 'git' command. Any number of arguments allowed.
Description:
This script cleans the repository interactively, leaving downloaded infrastructure untouched.
Clean operation is interactive to avoid losing new but unstaged files. Press 'c' then [Enter]
to perform the proposed deletions.
"
}
git_args=()
while [[ $# -gt 0 ]]; do
case $1 in
-\?|-h|--help)
__usage
exit 0
;;
*)
git_args[${#git_args[*]}]="$1"
;;
esac
shift
done
# This incantation avoids unbound variable issues if git_args is empty
# https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u
git clean -dix -e .dotnet/ -e .tools/ ${git_args[@]+"${git_args[@]}"}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化