ohmyzsh/plugins/copyfile/copyfile.plugin.zsh
Nuri Jung d47df7208a
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.
2025-09-19 21:16:40 +09:00

13 lines
277 B
Bash

# Copies the contents of a given file to the system or X Windows clipboard
#
# Usage: copyfile <file>
function copyfile {
emulate -L zsh
clipcopy "${1-}" || {
echo "Usage: copyfile <file>"
return 1
}
echo ${(%):-"%B${1:-/dev/stdin}%b copied to clipboard."}
}