fix curl grammer
This commit is contained in:
7
gitea.sh
7
gitea.sh
@ -110,6 +110,9 @@ load_config() {
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
# shellcheck source=/dev/null
|
||||
source "$CONFIG_FILE"
|
||||
# Sanitize variables to remove potential carriage returns from editing on Windows
|
||||
GITEA_URL=${GITEA_URL%$'\r'}
|
||||
ACCESS_TOKEN=${ACCESS_TOKEN%$'\r'}
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@ -123,6 +126,7 @@ prompt_for_config() {
|
||||
|
||||
while true; do
|
||||
read -r -p "请输入您的 Gitea 实例 URL (例如 https://git.example.com): " GITEA_URL
|
||||
GITEA_URL=${GITEA_URL%$'\r'}
|
||||
if [[ -n "$GITEA_URL" ]]; then break; else error "URL 不能为空。"; fi
|
||||
done
|
||||
|
||||
@ -130,6 +134,7 @@ prompt_for_config() {
|
||||
|
||||
while true; do
|
||||
read -r -s -p "请输入您的 Gitea Access Token: " GITEA_TOKEN
|
||||
GITEA_TOKEN=${GITEA_TOKEN%$'\r'}
|
||||
echo
|
||||
if [[ -n "$GITEA_TOKEN" ]]; then break; else error "Access Token 不能为空。"; fi
|
||||
done
|
||||
@ -260,6 +265,7 @@ main() {
|
||||
|
||||
local selected_repo
|
||||
selected_repo=$(echo "$repos" | fzf --height 40% --reverse --prompt="请选择一个仓库 > " --header="使用方向键导航, Enter 键选择。")
|
||||
selected_repo=${selected_repo%$'\r'} # Sanitize input from fzf
|
||||
|
||||
if [ -z "$selected_repo" ]; then
|
||||
info "未选择仓库,操作取消。"
|
||||
@ -294,6 +300,7 @@ main() {
|
||||
local OLD_IFS="$IFS"
|
||||
IFS=$'\n'
|
||||
for file in $selected_files; do
|
||||
file=${file%$'\r'} # Sanitize each line from fzf output
|
||||
((file_count++))
|
||||
if download_file "$selected_repo" "$file"; then
|
||||
((success_count++))
|
||||
|
||||
Reference in New Issue
Block a user