diff --git a/cmd/doodad/commands/convert.go b/cmd/doodad/commands/convert.go index 978bcb4..d0ef472 100644 --- a/cmd/doodad/commands/convert.go +++ b/cmd/doodad/commands/convert.go @@ -22,26 +22,28 @@ import ( // Convert between image files (png or bitmap) and Doodle drawing files (levels // and doodads) -var Convert cli.Command +var Convert *cli.Command func init() { - Convert = cli.Command{ + Convert = &cli.Command{ Name: "convert", Usage: "convert between images and Doodle drawing files", ArgsUsage: " ", Flags: []cli.Flag{ - cli.StringFlag{ + &cli.StringFlag{ Name: "key", Usage: "chroma key color for transparency on input image files", Value: "#ffffff", }, - cli.StringFlag{ - Name: "title, t", - Usage: "set the title of the level or doodad being created", + &cli.StringFlag{ + Name: "title", + Aliases: []string{"t"}, + Usage: "set the title of the level or doodad being created", }, - cli.StringFlag{ - Name: "palette, p", - Usage: "use a palette JSON to define color swatch properties", + &cli.StringFlag{ + Name: "palette", + Aliases: []string{"p"}, + Usage: "use a palette JSON to define color swatch properties", }, }, Action: func(c *cli.Context) error { @@ -63,7 +65,7 @@ func init() { ) } - args := c.Args() + args := c.Args().Slice() var ( inputFiles = args[:len(args)-1] inputType = strings.ToLower(filepath.Ext(inputFiles[0])) diff --git a/cmd/doodad/commands/edit_doodad.go b/cmd/doodad/commands/edit_doodad.go index 67c8c3e..6accf8b 100644 --- a/cmd/doodad/commands/edit_doodad.go +++ b/cmd/doodad/commands/edit_doodad.go @@ -11,43 +11,43 @@ import ( ) // EditDoodad allows writing doodad metadata. -var EditDoodad cli.Command +var EditDoodad *cli.Command func init() { - EditDoodad = cli.Command{ + EditDoodad = &cli.Command{ Name: "edit-doodad", Usage: "update metadata for a Doodad file", ArgsUsage: "", Flags: []cli.Flag{ - cli.BoolFlag{ + &cli.BoolFlag{ Name: "quiet, q", Usage: "limit output (don't show doodad data at the end)", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "title", Usage: "set the doodad title", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "author", Usage: "set the doodad author", }, - cli.StringSliceFlag{ + &cli.StringSliceFlag{ Name: "tag, t", Usage: "set a key/value tag on the doodad, in key=value format. Empty value deletes the tag.", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "hide", Usage: "Hide the doodad from the palette", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "unhide", Usage: "Unhide the doodad from the palette", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "lock", Usage: "write-lock the level file", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "unlock", Usage: "remove the write-lock on the level file", }, @@ -60,7 +60,7 @@ func init() { ) } - var filenames = c.Args() + var filenames = c.Args().Slice() for _, filename := range filenames { if err := editDoodad(c, filename); err != nil { log.Error("%s: %s", filename, err) diff --git a/cmd/doodad/commands/edit_level.go b/cmd/doodad/commands/edit_level.go index 7e219c3..1b922ae 100644 --- a/cmd/doodad/commands/edit_level.go +++ b/cmd/doodad/commands/edit_level.go @@ -10,47 +10,48 @@ import ( ) // EditLevel allows writing level metadata. -var EditLevel cli.Command +var EditLevel *cli.Command func init() { - EditLevel = cli.Command{ + EditLevel = &cli.Command{ Name: "edit-level", Usage: "update metadata for a Level file", ArgsUsage: "", Flags: []cli.Flag{ - cli.BoolFlag{ - Name: "quiet, q", - Usage: "limit output (don't show doodad data at the end)", + &cli.BoolFlag{ + Name: "quiet", + Aliases: []string{"q"}, + Usage: "limit output (don't show doodad data at the end)", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "title", Usage: "set the level title", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "author", Usage: "set the level author", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "password", Usage: "set the level password", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "type", Usage: "set the page type. One of: Unbounded, Bounded, NoNegativeSpace, Bordered", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "max-size", Usage: "set the page max size (WxH format, like 2550x3300)", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "wallpaper", Usage: "set the wallpaper filename", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "lock", Usage: "write-lock the level file", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "unlock", Usage: "remove the write-lock on the level file", }, @@ -63,7 +64,7 @@ func init() { ) } - var filenames = c.Args() + var filenames = c.Args().Slice() for _, filename := range filenames { if err := editLevel(c, filename); err != nil { log.Error("%s: %s", filename, err) diff --git a/cmd/doodad/commands/install_script.go b/cmd/doodad/commands/install_script.go index 172215c..712bf62 100644 --- a/cmd/doodad/commands/install_script.go +++ b/cmd/doodad/commands/install_script.go @@ -10,15 +10,15 @@ import ( ) // InstallScript to add the script to a doodad file. -var InstallScript cli.Command +var InstallScript *cli.Command func init() { - InstallScript = cli.Command{ + InstallScript = &cli.Command{ Name: "install-script", Usage: "install the JavaScript source to a doodad", ArgsUsage: " ", Flags: []cli.Flag{ - cli.StringFlag{ + &cli.StringFlag{ Name: "key", Usage: "chroma key color for transparency on input image files", Value: "#ffffff", @@ -34,8 +34,8 @@ func init() { var ( args = c.Args() - scriptFile = args[0] - doodadFile = args[1] + scriptFile = args.Get(0) + doodadFile = args.Get(1) ) // Read the JavaScript source. diff --git a/cmd/doodad/commands/show.go b/cmd/doodad/commands/show.go index 62ca9ac..c6cd98e 100644 --- a/cmd/doodad/commands/show.go +++ b/cmd/doodad/commands/show.go @@ -13,29 +13,30 @@ import ( ) // Show information about a Level or Doodad file. -var Show cli.Command +var Show *cli.Command func init() { - Show = cli.Command{ + Show = &cli.Command{ Name: "show", Usage: "show information about a level or doodad file", ArgsUsage: "<.level or .doodad>", Flags: []cli.Flag{ - cli.BoolFlag{ + &cli.BoolFlag{ Name: "actors", Usage: "print verbose actor data in Level files", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "chunks", Usage: "print verbose data about all the pixel chunks in a file", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "script", Usage: "print the script from a doodad file and exit", }, - cli.BoolFlag{ - Name: "verbose, v", - Usage: "print verbose output (all verbose flags enabled)", + &cli.BoolFlag{ + Name: "verbose", + Aliases: []string{"v"}, + Usage: "print verbose output (all verbose flags enabled)", }, }, Action: func(c *cli.Context) error { @@ -46,7 +47,7 @@ func init() { ) } - filenames := c.Args() + filenames := c.Args().Slice() for _, filename := range filenames { switch strings.ToLower(filepath.Ext(filename)) { case enum.LevelExt: diff --git a/cmd/doodad/main.go b/cmd/doodad/main.go index 2fc793b..a99b9df 100644 --- a/cmd/doodad/main.go +++ b/cmd/doodad/main.go @@ -44,13 +44,13 @@ func main() { ) app.Flags = []cli.Flag{ - cli.BoolFlag{ + &cli.BoolFlag{ Name: "debug, d", Usage: "enable debug level logging", }, } - app.Commands = []cli.Command{ + app.Commands = []*cli.Command{ commands.Convert, commands.Show, commands.EditLevel, diff --git a/cmd/doodle/main.go b/cmd/doodle/main.go index 74f2e03..e254705 100644 --- a/cmd/doodle/main.go +++ b/cmd/doodle/main.go @@ -55,15 +55,17 @@ func main() { ) app.Flags = []cli.Flag{ - cli.BoolFlag{ - Name: "debug, d", - Usage: "enable debug level logging", + &cli.BoolFlag{ + Name: "debug", + Aliases: []string{"d"}, + Usage: "enable debug level logging", }, - cli.BoolFlag{ - Name: "edit, e", - Usage: "edit the map given on the command line (instead of play it)", + &cli.BoolFlag{ + Name: "edit", + Aliases: []string{"e"}, + Usage: "edit the map given on the command line (instead of play it)", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "guitest", Usage: "enter the GUI Test scene on startup", },