mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 13:02:04 +08:00
feature: Add -windowsconsole
flag
This commit is contained in:
parent
4c312b155d
commit
4726b72708
@ -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
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
@ -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!
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user