mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 06:24:01 +00:00
c2970f9618
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python. If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
17 lines
632 B
Fish
17 lines
632 B
Fish
function fish_clipboard_copy
|
|
# Copy the current selection, or the entire commandline if that is empty.
|
|
set -l cmdline (commandline --current-selection)
|
|
test -n "$cmdline"
|
|
or set cmdline (commandline)
|
|
if type -q pbcopy
|
|
printf '%s\n' $cmdline | pbcopy
|
|
else if type -q xsel
|
|
# Silence error so no error message shows up
|
|
# if e.g. X isn't running.
|
|
printf '%s\n' $cmdline | xsel --clipboard 2>/dev/null
|
|
else if type -q xclip
|
|
printf '%s\n' $cmdline | xclip -selection clipboard 2>/dev/null
|
|
else if type -q wl-copy
|
|
printf '%s\n' $cmdline | wl-copy
|
|
end
|
|
end
|