refactor(clipboard): share provider detection across y/p/paste/hist
Extracts _fish_clipboard_copy and _fish_clipboard_paste so the wl-copy/xclip/win32yank fallback chain lives in one place instead of four near-duplicates. hist now goes through the same chain, so it also gets the xclip (X11) fallback it was missing before, alongside win32yank on WSL2.
This commit is contained in:
+4
-10
@@ -11,6 +11,9 @@
|
||||
# Outputs clipboard contents to stdout. Uses wl-paste on Wayland, xclip on
|
||||
# X11, or win32yank on WSL2.
|
||||
#
|
||||
# DEPENDENCIES
|
||||
# _fish_clipboard_paste
|
||||
#
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to the clipboard tool
|
||||
#
|
||||
@@ -24,14 +27,5 @@
|
||||
# EXAMPLE
|
||||
# paste > file.txt
|
||||
function paste --description 'Paste from clipboard'
|
||||
if type -q wl-paste
|
||||
wl-paste $argv
|
||||
else if type -q xclip
|
||||
xclip -selection clipboard -o $argv
|
||||
else if type -q win32yank.exe
|
||||
win32yank.exe -o --lf $argv
|
||||
else
|
||||
echo "Error: No clipboard provider (wl-paste, xclip, or win32yank) found." >&2
|
||||
return 1
|
||||
end
|
||||
_fish_clipboard_paste $argv
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user