From d47df7208af6ff294707b59fc94fea5b29618f5c Mon Sep 17 00:00:00 2001 From: Nuri Jung Date: Fri, 19 Sep 2025 21:14:34 +0900 Subject: [PATCH] fix(plugins/copyfile): don't fail with empty filename clipcopy interprets empty filename as stdin, but the current "error handling" breaks its behavior. This bug was introduced in ohmyzsh/ohmyzsh#13248. --- plugins/copyfile/copyfile.plugin.zsh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/plugins/copyfile/copyfile.plugin.zsh b/plugins/copyfile/copyfile.plugin.zsh index 3281410e5..da6e4039c 100644 --- a/plugins/copyfile/copyfile.plugin.zsh +++ b/plugins/copyfile/copyfile.plugin.zsh @@ -4,16 +4,10 @@ function copyfile { emulate -L zsh - if [[ -z "$1" ]]; then + clipcopy "${1-}" || { echo "Usage: copyfile " return 1 - fi + } - if [[ ! -f "$1" ]]; then - echo "Error: '$1' is not a valid file." - return 1 - fi - - clipcopy $1 - echo ${(%):-"%B$1%b copied to clipboard."} + echo ${(%):-"%B${1:-/dev/stdin}%b copied to clipboard."} }