Skip to content

Commit 5fae6e2

Browse files
committed
fix(setup): correctly auto-detect username when using --full
Argument parsing prevented auto-detection from running when --full was supplied without an explicit username. After shifting --full, no positional arguments remained, but the script had already skipped the auto-detection branch, leaving USERNAME empty and causing the script to abort.
1 parent 7973216 commit 5fae6e2

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

docs/contribution/setup-fork.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ if [[ $# -gt 0 ]]; then
237237
# Check for --full flag
238238
if [[ "$1" == "--full" ]]; then
239239
UPDATE_ALL=true
240-
AUTO_DETECT=true
241240
shift # Remove --full from arguments
242241
fi
243242

@@ -250,8 +249,10 @@ if [[ $# -gt 0 ]]; then
250249
REPO_NAME="$2"
251250
fi
252251
fi
253-
else
254-
# Try auto-detection
252+
fi
253+
254+
# Try auto-detection
255+
if [[ -z "$USERNAME" ]]; then
255256
if username=$(detect_username); then
256257
USERNAME="$username"
257258
print_success "Detected GitHub username: $USERNAME"
@@ -261,14 +262,15 @@ else
261262
echo " ./setup-fork.sh YOUR_USERNAME"
262263
exit 1
263264
fi
265+
fi
264266

265-
if repo_name=$(detect_repo_name); then
266-
REPO_NAME="$repo_name"
267-
if [[ "$REPO_NAME" != "ProxmoxVE" ]]; then
268-
print_info "Detected custom repo name: $REPO_NAME"
269-
else
270-
print_success "Using default repo name: ProxmoxVE"
271-
fi
267+
# Auto-detect repo name if needed
268+
if repo_name=$(detect_repo_name); then
269+
REPO_NAME="$repo_name"
270+
if [[ "$REPO_NAME" != "ProxmoxVE" ]]; then
271+
print_info "Detected custom repo name: $REPO_NAME"
272+
else
273+
print_success "Using default repo name: ProxmoxVE"
272274
fi
273275
fi
274276

0 commit comments

Comments
 (0)