Skip to content

Commit 918d19f

Browse files
Refactor download function in zsh script to improve permission handling by conditionally adding the permissions-bypass option based on the presence of a public key.
1 parent 69b7836 commit 918d19f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

common/zsh/.oh-my-zsh/custom/download.zsh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ download() {
88
fi
99

1010
if ! command -v kitten >/dev/null 2>&1; then
11-
print -u2 "download: 'kitten' not found. Tip: login using 'kitten ssh user@host' (recommended) or install kitty/kitten on this remote."
11+
print -u2 "download: 'kitten' not found. Install kitty/kitten on this remote."
1212
return 127
1313
fi
1414

1515
local -a transfer_opts
16-
transfer_opts=(--transmit-deltas --compress=auto --permissions-bypass yes)
16+
transfer_opts=(--transmit-deltas --compress=auto)
17+
if [[ -n "${KITTY_PUBLIC_KEY:-}" ]]; then
18+
transfer_opts+=(--permissions-bypass yes)
19+
fi
1720

1821
# NOTE:
1922
# - Destination 'Downloads/' is interpreted on the RECEIVING side (your local machine).

0 commit comments

Comments
 (0)