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",
Usage: "set the doodad hitbox (X,Y,W,H or W,H format)",
},
&cli.StringSliceFlag{
&cli.StringFlag{
Name: "tag",
Aliases: []string{"t"},
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 := c.StringSlice("tag")
if len(tags) > 0 {
for _, tag := range tags {
parts := strings.SplitN(tag, "=", 2)
tag := c.String("tag")
if len(tag) > 0 {
parts := strings.SplitN(tag, "=", 3)
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)
}
@ -167,7 +166,6 @@ func editDoodad(c *cli.Context, filename string) error {
modified = true
}
}
if c.Bool("hide") {
dd.Hidden = true