Fix doodad tool --tag property

This commit is contained in:
Noah 2022-05-08 10:58:53 -07:00
parent a28644d253
commit d7f247e4cc

View File

@ -38,7 +38,7 @@ func init() {
Name: "hitbox", Name: "hitbox",
Usage: "set the doodad hitbox (X,Y,W,H or W,H format)", Usage: "set the doodad hitbox (X,Y,W,H or W,H format)",
}, },
&cli.StringSliceFlag{ &cli.StringFlag{
Name: "tag", Name: "tag",
Aliases: []string{"t"}, Aliases: []string{"t"},
Usage: "set a key/value tag on the doodad, in key=value format. Empty value deletes the tag.", Usage: "set a key/value tag on the doodad, in key=value format. Empty value deletes the tag.",
@ -144,12 +144,11 @@ func editDoodad(c *cli.Context, filename string) error {
} }
// Tags. // Tags.
tags := c.StringSlice("tag") tag := c.String("tag")
if len(tags) > 0 { if len(tag) > 0 {
for _, tag := range tags { parts := strings.SplitN(tag, "=", 3)
parts := strings.SplitN(tag, "=", 2)
if len(parts) != 2 { if len(parts) != 2 {
log.Error("--tag: must be in format `key=value`. Value may be blank to delete a tag. len=%d", len(parts)) log.Error("--tag: must be in format `key=value`. Value may be blank to delete a tag. len=%d tag=%s got=%+v", len(parts), tag, parts)
os.Exit(1) os.Exit(1)
} }
@ -167,7 +166,6 @@ func editDoodad(c *cli.Context, filename string) error {
modified = true modified = true
} }
}
if c.Bool("hide") { if c.Bool("hide") {
dd.Hidden = true dd.Hidden = true