feature: Add -windowsconsole flag

This commit is contained in:
Lea Anthony
2022-07-04 22:52:50 +10:00
parent 4c312b155d
commit 4726b72708
4 changed files with 7 additions and 1 deletions
@@ -102,6 +102,9 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
raceDetector := false
command.BoolFlag("race", "Build with Go's race detector", &raceDetector)
windowsConsole := false
command.BoolFlag("windowsconsole", "Keep the console when building for Windows", &windowsConsole)
command.Action(func() error {
quiet := verbosity == 0
@@ -184,6 +187,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
WebView2Strategy: wv2rtstrategy,
TrimPath: trimpath,
RaceDetector: raceDetector,
WindowsConsole: windowsConsole,
}
// Start a new tabwriter
+1 -1
View File
@@ -217,7 +217,7 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
if options.Mode == Production {
ldflags.Add("-w", "-s")
if options.Platform == "windows" {
if options.Platform == "windows" && !options.WindowsConsole {
ldflags.Add("-H windowsgui")
}
}
+1
View File
@@ -57,6 +57,7 @@ type Options struct {
BundleName string // Bundlename for Mac
TrimPath bool // Use Go's trimpath compiler flag
RaceDetector bool // Build with Go's race detector
WindowsConsole bool // Indicates that the windows console should be kept
}
// Build the project!
+1
View File
@@ -71,6 +71,7 @@ A list of community maintained templates can be found [here](../community/templa
| -debug | Retains debug information in the application. Allows the use of the devtools in the application window | false |
| -trimpath | Remove all file system paths from the resulting executable. | false |
| -race | Build with Go's race detector | false |
| -windowsconsole | Keep the console window for Windows builds | false |
For a detailed description of the `webview2` flag, please refer to the [Windows](../guides/windows.mdx) Guide.