mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
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.
This commit is contained in:
parent
9e23925b85
commit
d47df7208a
1 changed files with 3 additions and 9 deletions
|
|
@ -4,16 +4,10 @@
|
||||||
function copyfile {
|
function copyfile {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
|
|
||||||
if [[ -z "$1" ]]; then
|
clipcopy "${1-}" || {
|
||||||
echo "Usage: copyfile <file>"
|
echo "Usage: copyfile <file>"
|
||||||
return 1
|
return 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
if [[ ! -f "$1" ]]; then
|
echo ${(%):-"%B${1:-/dev/stdin}%b copied to clipboard."}
|
||||||
echo "Error: '$1' is not a valid file."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
clipcopy $1
|
|
||||||
echo ${(%):-"%B$1%b copied to clipboard."}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue