mirror of https://github.com/icedream/ui2walk.git
Introduce -pkg parameter to define package name for UI code.
parent
bb2f57592b
commit
6f3bcb07a2
|
@ -22,6 +22,7 @@ import (
|
||||||
|
|
||||||
var forceUpdate *bool = flag.Bool("force", false, "forces code generation for up-to-date files")
|
var forceUpdate *bool = flag.Bool("force", false, "forces code generation for up-to-date files")
|
||||||
var translatable *bool = flag.Bool("tr", false, "adds calls to a user provided 'func tr(source string, context ...string) string' that returns a translation of the source argument, using provided context args for disambiguation")
|
var translatable *bool = flag.Bool("tr", false, "adds calls to a user provided 'func tr(source string, context ...string) string' that returns a translation of the source argument, using provided context args for disambiguation")
|
||||||
|
var packageName *string = flag.String("pkg", "main", "defines the package name for which to generate the code")
|
||||||
|
|
||||||
type String struct {
|
type String struct {
|
||||||
Text string `xml:"string"`
|
Text string `xml:"string"`
|
||||||
|
@ -891,19 +892,19 @@ func writeActionInitializations(buf *bytes.Buffer, actions []*Action) error {
|
||||||
|
|
||||||
func generateUICode(buf *bytes.Buffer, ui *UI) error {
|
func generateUICode(buf *bytes.Buffer, ui *UI) error {
|
||||||
// Comment, package decl, imports
|
// Comment, package decl, imports
|
||||||
buf.WriteString(
|
buf.WriteString(fmt.Sprintf(
|
||||||
`// This file was created by ui2walk and may be regenerated.
|
`// This file was created by ui2walk and may be regenerated.
|
||||||
// DO NOT EDIT OR YOUR MODIFICATIONS WILL BE LOST!
|
// DO NOT EDIT OR YOUR MODIFICATIONS WILL BE LOST!
|
||||||
|
|
||||||
//+build windows
|
//+build windows
|
||||||
|
|
||||||
package main
|
package %s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lxn/walk"
|
"github.com/lxn/walk"
|
||||||
)
|
)
|
||||||
|
|
||||||
`)
|
`, *packageName))
|
||||||
|
|
||||||
// Embed the corresponding Walk type.
|
// Embed the corresponding Walk type.
|
||||||
var embeddedType string
|
var embeddedType string
|
||||||
|
|
Loading…
Reference in New Issue