forked from so-fancy/diff-so-fancy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
report-bug.sh
executable file
·60 lines (53 loc) · 1.23 KB
/
report-bug.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
clipboard() {
local copy_cmd
if [ -n "$PBCOPY_SERVER" ]; then
local body="" # buffer
body=$(cat)
# while IFS= read -r buffer; do
# body="$body$buffer\n";
# done
curl "$PBCOPY_SERVER" --data-urlencode body="$body" >/dev/null 2>&1
return $?
fi
if type putclip >/dev/null 2>&1; then
copy_cmd="putclip"
elif [ -e /dev/clipboard ];then
cat > /dev/clipboard
return 0
elif type clip >/dev/null 2>&1; then
if [[ $LANG = UTF-8 ]]; then
copy_cmd="iconv -f utf-8 -t shift_jis | clip"
else
copy_cmd=clip
fi
# copy_cmd=clip
elif command -v pbcopy >/dev/null 2>&1; then
copy_cmd="pbcopy"
elif command -v xclip >/dev/null 2>&1; then
# copy_cmd="xclip -i -selection clipboard"
copy_cmd="xclip"
elif command -v xsel >/dev/null 2>&1 ; then
local copy_cmd="xsel -b"
fi
if [ -n "$copy_cmd" ] ;then
eval "$copy_cmd"
else
echo "clipboard is unavailable" 1>&2
fi
}
file=${2:-diff.txt}
{
echo "$1"
eval "$1"
echo ""
echo ""
echo ""
echo "$1 --color"
eval "$1 --color"
echo "git config pager.diff"
eval "git config pager.diff"
echo "git config pager.show"
eval "git config pager.show"
} > "$file"
base64 < "$file" | clipboard