Skip to content

Commit 0b39dfb

Browse files
Update report-bug.sh for #461
1 parent ee88b68 commit 0b39dfb

File tree

2 files changed

+57
-55
lines changed

2 files changed

+57
-55
lines changed

report-bug.sh

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,66 @@
11
#!/bin/bash
22

33
clipboard() {
4-
local copy_cmd
5-
if [ -n "$PBCOPY_SERVER" ]; then
6-
local body="" # buffer
7-
body=$(cat)
8-
# while IFS= read -r buffer; do
9-
# body="$body$buffer\n";
10-
# done
11-
curl "$PBCOPY_SERVER" --data-urlencode body="$body" >/dev/null 2>&1
12-
return $?
13-
fi
14-
if type putclip >/dev/null 2>&1; then
15-
copy_cmd="putclip"
16-
elif [ -e /dev/clipboard ];then
17-
cat > /dev/clipboard
18-
return 0
19-
elif type clip >/dev/null 2>&1; then
20-
if [[ $LANG = UTF-8 ]]; then
21-
copy_cmd="iconv -f utf-8 -t shift_jis | clip"
22-
else
23-
copy_cmd=clip
24-
fi
25-
# copy_cmd=clip
26-
elif command -v pbcopy >/dev/null 2>&1; then
27-
copy_cmd="pbcopy"
28-
elif command -v xclip >/dev/null 2>&1; then
29-
# copy_cmd="xclip -i -selection clipboard"
30-
copy_cmd="xclip"
31-
elif command -v xsel >/dev/null 2>&1 ; then
32-
local copy_cmd="xsel -b"
33-
fi
34-
if [ -n "$copy_cmd" ] ;then
35-
eval "$copy_cmd"
36-
else
37-
echo "clipboard is unavailable" 1>&2
38-
fi
4+
local copy_cmd
5+
6+
if [ -n "$PBCOPY_SERVER" ]; then
7+
local body="" # buffer
8+
body=$(cat)
9+
# while IFS= read -r buffer; do
10+
# body="$body$buffer\n";
11+
# done
12+
curl "$PBCOPY_SERVER" --data-urlencode body="$body" >/dev/null 2>&1
13+
return $?
14+
fi
15+
16+
if type putclip >/dev/null 2>&1; then
17+
copy_cmd="putclip"
18+
elif [ -e /dev/clipboard ];then
19+
cat > /dev/clipboard
20+
return 0
21+
elif type clip >/dev/null 2>&1; then
22+
if [[ $LANG = UTF-8 ]]; then
23+
copy_cmd="iconv -f utf-8 -t shift_jis | clip"
24+
else
25+
copy_cmd=clip
26+
fi
27+
# copy_cmd=clip
28+
elif command -v pbcopy >/dev/null 2>&1; then
29+
copy_cmd="pbcopy"
30+
elif command -v xclip >/dev/null 2>&1; then
31+
# copy_cmd="xclip -i -selection clipboard"
32+
copy_cmd="xclip"
33+
elif command -v xsel >/dev/null 2>&1 ; then
34+
local copy_cmd="xsel -b"
35+
fi
36+
37+
if [ -n "$copy_cmd" ] ;then
38+
eval "$copy_cmd"
39+
else
40+
echo "clipboard is unavailable" 1>&2
41+
fi
3942
}
4043

41-
file=${2:-diff.txt}
44+
if [ $# -eq 0 ]; then
45+
echo "Usage: $0 'git diff HEAD..HEAD^'"
46+
exit 7
47+
fi
4248

43-
{
44-
echo "$1"
45-
eval "$1"
46-
echo ""
47-
echo ""
48-
echo ""
49+
file=${2:-dsf-bug-report.txt}
4950

50-
echo "$1 --color"
51-
eval "$1 --color"
51+
{
52+
echo "$1"
53+
eval "$1"
54+
echo ""
55+
echo ""
56+
echo ""
5257

53-
echo "git config pager.diff"
54-
eval "git config pager.diff"
58+
echo "$1 --color"
59+
eval "$1 --color"
5560

56-
echo "git config pager.show"
57-
eval "git config pager.show"
58-
} > "$file"
61+
echo "git config --list | grep pager"
62+
eval "git config --list | grep pager"
63+
} | base64 > "$file"
5964

60-
base64 < "$file" | clipboard
65+
echo "Wrote file: $file"
66+
echo "Please open a new issue on Github and attach it"

reporting-bugs.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ You can use [report-bug.sh](./report-bug.sh) we provide
1010

1111
```sh
1212
./report-bug.sh 'git diff HEAD..HEAD^'
13-
14-
# or
15-
16-
curl https://raw.githubusercontent.com/so-fancy/diff-so-fancy/master/report-bug.sh | bash -s 'git diff HEAD..HEAD^' 'diff.txt'
1713
```
1814

19-
Grab the output file and attach to the GitHub issue you create. A base64 version is also copied to your clipboard so you can paste to the issue.
15+
Attach the output file to the GitHub issue you create.

0 commit comments

Comments
 (0)