mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 01:43:15 +08:00
commit
2da21ec528
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
@ -190,7 +191,7 @@ func (po *ProjectOptions) PromptForInputs() error {
|
|||||||
po.NPMProjectName = strings.ToLower(strings.Replace(po.Name, " ", "_", -1))
|
po.NPMProjectName = strings.ToLower(strings.Replace(po.Name, " ", "_", -1))
|
||||||
|
|
||||||
// Fix template name
|
// Fix template name
|
||||||
po.Template = strings.Split(po.selectedTemplate.Path, "/")[0]
|
po.Template = strings.Split(po.selectedTemplate.Path, string(os.PathSeparator))[0]
|
||||||
|
|
||||||
// // Populate template details
|
// // Populate template details
|
||||||
templateMetadata := po.selectedTemplate.Metadata
|
templateMetadata := po.selectedTemplate.Metadata
|
||||||
|
@ -1,25 +1,26 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Prompt asks the user for a value
|
// Prompt asks the user for a value
|
||||||
func Prompt(question string, defaultValue ...string) string {
|
func Prompt(question string, defaultValue ...string) string {
|
||||||
var answer string
|
var answer string
|
||||||
haveDefault := len(defaultValue) > 0 && defaultValue[0] != ""
|
|
||||||
|
|
||||||
if haveDefault {
|
if len(defaultValue) > 0 {
|
||||||
question = fmt.Sprintf("%s (%s)", question, defaultValue[0])
|
answer = defaultValue[0]
|
||||||
|
question = fmt.Sprintf("%s (%s)", question, answer)
|
||||||
}
|
}
|
||||||
fmt.Printf(question + ": ")
|
fmt.Printf(question + ": ")
|
||||||
fmt.Scanln(&answer)
|
scanner := bufio.NewScanner(os.Stdin)
|
||||||
if haveDefault {
|
if scanner.Scan() {
|
||||||
if len(answer) == 0 {
|
answer = scanner.Text()
|
||||||
answer = defaultValue[0]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return answer
|
return answer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,4 +2,4 @@ package cmd
|
|||||||
|
|
||||||
// Version - Wails version
|
// Version - Wails version
|
||||||
// ...oO(There must be a better way)
|
// ...oO(There must be a better way)
|
||||||
const Version = "v0.9.6"
|
const Version = "v0.9.7"
|
||||||
|
74
cmd/wails/9_issue.go
Normal file
74
cmd/wails/9_issue.go
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/pkg/browser"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/cmd"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
|
||||||
|
commandDescription := `Generates an issue in Github using the given title, description and system report.`
|
||||||
|
|
||||||
|
initCommand := app.Command("issue", "Generates an issue in Github.").
|
||||||
|
LongDescription(commandDescription)
|
||||||
|
|
||||||
|
initCommand.Action(func() error {
|
||||||
|
|
||||||
|
logger.PrintSmallBanner("Generate Issue")
|
||||||
|
fmt.Println()
|
||||||
|
message := `Thanks for taking the time to submit an issue!
|
||||||
|
|
||||||
|
To help you in this process, we will ask for some information, add Go/Wails details automatically, then prepare the issue for your editing and submission.
|
||||||
|
`
|
||||||
|
|
||||||
|
logger.Yellow(message)
|
||||||
|
|
||||||
|
title := cmd.Prompt("Issue Title")
|
||||||
|
description := cmd.Prompt("Issue Description")
|
||||||
|
|
||||||
|
var str strings.Builder
|
||||||
|
|
||||||
|
gomodule, exists := os.LookupEnv("GO111MODULE")
|
||||||
|
if !exists {
|
||||||
|
gomodule = "(Not Set)"
|
||||||
|
}
|
||||||
|
|
||||||
|
str.WriteString("\n| Name | Value |\n| ----- | ----- |\n")
|
||||||
|
str.WriteString(fmt.Sprintf("| Wails Version | %s |\n", cmd.Version))
|
||||||
|
str.WriteString(fmt.Sprintf("| Go Version | %s |\n", runtime.Version()))
|
||||||
|
str.WriteString(fmt.Sprintf("| Platform | %s |\n", runtime.GOOS))
|
||||||
|
str.WriteString(fmt.Sprintf("| Arch | %s |\n", runtime.GOARCH))
|
||||||
|
str.WriteString(fmt.Sprintf("| GO111MODULE | %s |\n", gomodule))
|
||||||
|
|
||||||
|
fmt.Println()
|
||||||
|
fmt.Println("Processing template and preparing for upload.")
|
||||||
|
|
||||||
|
// Grab issue template
|
||||||
|
resp, err := http.Get("https://raw.githubusercontent.com/wailsapp/wails/master/.github/ISSUE_TEMPLATE/bug_report.md")
|
||||||
|
if err != nil {
|
||||||
|
logger.Red("Unable to read in issue template. Are you online?")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
template, _ := ioutil.ReadAll(resp.Body)
|
||||||
|
body := string(template)
|
||||||
|
body = "**Description**\n" + (strings.Split(body, "**Description**")[1])
|
||||||
|
fullURL := "https://github.com/wailsapp/wails/issues/new?"
|
||||||
|
body = strings.Replace(body, "A clear and concise description of what the bug is.", description, -1)
|
||||||
|
body = strings.Replace(body, "Please paste the output of `wails report` here.", str.String(), -1)
|
||||||
|
params := "title=" + title + "&body=" + body
|
||||||
|
|
||||||
|
fmt.Println("Opening browser to file issue.")
|
||||||
|
browser.OpenURL(fullURL + url.PathEscape(params))
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
1
go.mod
1
go.mod
@ -35,6 +35,7 @@ require (
|
|||||||
github.com/mitchellh/go-homedir v1.1.0
|
github.com/mitchellh/go-homedir v1.1.0
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
|
||||||
github.com/openzipkin/zipkin-go v0.1.5 // indirect
|
github.com/openzipkin/zipkin-go v0.1.5 // indirect
|
||||||
|
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
|
||||||
github.com/pkg/errors v0.8.1 // indirect
|
github.com/pkg/errors v0.8.1 // indirect
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
|
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
|
||||||
github.com/prometheus/common v0.2.0 // indirect
|
github.com/prometheus/common v0.2.0 // indirect
|
||||||
|
2
go.sum
2
go.sum
@ -138,6 +138,8 @@ github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTm
|
|||||||
github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||||
github.com/openzipkin/zipkin-go v0.1.5/go.mod h1:8NDCjKHoHW1XOp/vf3lClHem0b91r4433B67KXyKXAQ=
|
github.com/openzipkin/zipkin-go v0.1.5/go.mod h1:8NDCjKHoHW1XOp/vf3lClHem0b91r4433B67KXyKXAQ=
|
||||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||||
|
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98=
|
||||||
|
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
Loading…
Reference in New Issue
Block a user