-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpatch.sh
More file actions
executable file
·30 lines (25 loc) · 870 Bytes
/
patch.sh
File metadata and controls
executable file
·30 lines (25 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
clipboard_paste() {
pbpaste
}
else
# Linux
clipboard_paste() {
if [ -n "$WAYLAND_DISPLAY" ]; then
wl-paste
elif [ -n "$DISPLAY" ]; then
xclip -selection clipboard -o
else
echo "Clipboard paste functionality not available in this environment" >&2
fi
}
fi
if [[ "$OSTYPE" != "darwin"* ]] && [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
echo "Note: You are not in a graphical environment. Clipboard functionality may be limited."
fi
# clipboard_paste | (recountdiff && echo "") | patch -p0 -F4 --dry-run --ignore-whitespace --verbose && \
# echo "WORKS!"
clipboard_paste | (recountdiff && echo "") | patch -p0 -F4 --dry-run --ignore-whitespace --verbose && \
clipboard_paste | (recountdiff && echo "") | patch -p0 -F4 --ignore-whitespace