add a way to add arbitrary plist contents
This commit is contained in:
13
main.go
13
main.go
@@ -29,6 +29,7 @@ func run() error {
|
||||
version = flag.String("version", "1.0", "app version")
|
||||
identifier = flag.String("id", "", "bundle identifier")
|
||||
icon = flag.String("icon", "", "icon image file (.icns|.png|.jpg|.jpeg)")
|
||||
extraPlist = flag.String("plist", "", "path to file with additional plist dict key/value items")
|
||||
)
|
||||
flag.Parse()
|
||||
args := flag.Args()
|
||||
@@ -70,6 +71,13 @@ func run() error {
|
||||
if id == "" {
|
||||
id = *author + "." + *name
|
||||
}
|
||||
if *extraPlist != "" {
|
||||
b, err := os.ReadFile(*extraPlist)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error reading plist location: "+*extraPlist)
|
||||
}
|
||||
*extraPlist = string(b)
|
||||
}
|
||||
info := infoListData{
|
||||
Name: *name,
|
||||
Executable: filepath.Join("MacOS", appname),
|
||||
@@ -77,6 +85,7 @@ func run() error {
|
||||
Version: *version,
|
||||
InfoString: *name + " by " + *author,
|
||||
ShortVersionString: *version,
|
||||
AdditionalPList: *extraPlist,
|
||||
}
|
||||
if *icon != "" {
|
||||
iconPath, err := prepareIcons(*icon, resouresPath)
|
||||
@@ -150,6 +159,7 @@ type infoListData struct {
|
||||
InfoString string
|
||||
ShortVersionString string
|
||||
IconFile string
|
||||
AdditionalPList string
|
||||
}
|
||||
|
||||
const infoPlistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
@@ -176,6 +186,9 @@ const infoPlistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>{{ .IconFile }}</string>
|
||||
{{- end }}
|
||||
{{- if .AdditionalPList -}}
|
||||
{{ .AdditionalPList -}}
|
||||
{{- end }}
|
||||
</dict>
|
||||
</plist>
|
||||
`
|
||||
|
Reference in New Issue
Block a user