-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
feedback.go
56 lines (44 loc) · 992 Bytes
/
feedback.go
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
package lib
import (
"fmt"
"net/url"
"strings"
"github.com/hofstadter-io/hof/lib/yagu"
"github.com/hofstadter-io/hof/cmd/hof/flags"
"github.com/hofstadter-io/hof/cmd/hof/verinfo"
)
var info = `
Add more information here
---
Hof Metadata:
<pre>
Version: v%s
Commit: %s
BuildDate: %s
GoVersion: %s
OS / Arch: %s %s
</pre>
`
func SendFeedback(args []string, rflags flags.RootPflagpole, cflags flags.FeedbackPflagpole) error {
title := url.QueryEscape(strings.Join(args, " "))
body := fmt.Sprintf(
info,
verinfo.Version,
verinfo.Commit,
verinfo.BuildDate,
verinfo.GoVersion,
verinfo.BuildOS,
verinfo.BuildArch,
)
body = url.QueryEscape(body)
labels := cflags.Labels
what := "discussions"
catg := "category=general&"
if cflags.Issue {
what = "issues"
catg = ""
}
url := fmt.Sprintf("https://github.com/hofstadter-io/hof/%s/new?%slabels=%s&title=%s&body=%s", what, catg, labels, title, body)
yagu.OpenBrowserCmdSafe(url)
return nil
}