Noah Petherbridge
a06787411d
* pkg/plus/dpp is the main plugin bridge, and defines nothing but an interface that defines the Doodle++ surface area (referring to internal game types such as doodad.Doodad or level.Level), but not their implementations. * dpp.Driver (an interface) is the main API that other parts of the game will call, for example "dpp.Driver.IsLevelSigned()" * plus_dpp.go and plus_foss.go provide the dpp.Driver implementation for their build; with plus_dpp.go generally forwarding function calls directly to the proprietary dpp package and plus_foss.go generally returning false/errors. * The bootstrap package simply assigns the above stub function to dpp.Driver * pkg/plus/bootstrap is a package directly imported by main (in the doodle and doodad programs) and it works around circular dependency issues: this package simply assigns dpp.Driver to the DPP or FOSS version. Miscellaneous fixes: * File->Open in the editor and PlayScene will use the new Open Level window instead of loading the legacy GotoLoadMenu scene. * Deprecated legacy scenes: d.GotoLoadMenu() and d.GotoPlayMenu(). * The doodle-admin program depends on the private dpp package, so can not be compiled in FOSS mode.
68 lines
1.2 KiB
Go
68 lines
1.2 KiB
Go
// doodad is the command line developer tool for Doodle.
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"sort"
|
|
"time"
|
|
|
|
"git.kirsle.net/SketchyMaze/doodle/cmd/doodad/commands"
|
|
"git.kirsle.net/SketchyMaze/doodle/pkg/branding/builds"
|
|
"git.kirsle.net/SketchyMaze/doodle/pkg/log"
|
|
"git.kirsle.net/SketchyMaze/doodle/pkg/plus/bootstrap"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// Build variables.
|
|
var (
|
|
Build = "N/A"
|
|
BuildDate string
|
|
)
|
|
|
|
func init() {
|
|
if BuildDate == "" {
|
|
BuildDate = time.Now().Format(time.RFC3339)
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
bootstrap.InitPlugins()
|
|
|
|
app := cli.NewApp()
|
|
app.Name = "doodad"
|
|
app.Usage = "command line interface for Doodle"
|
|
|
|
app.Version = fmt.Sprintf("%s build %s. Built on %s",
|
|
builds.Version,
|
|
Build,
|
|
BuildDate,
|
|
)
|
|
|
|
app.Flags = []cli.Flag{
|
|
&cli.BoolFlag{
|
|
Name: "debug, d",
|
|
Usage: "enable debug level logging",
|
|
},
|
|
}
|
|
|
|
app.Commands = []*cli.Command{
|
|
commands.Convert,
|
|
commands.Show,
|
|
commands.Resave,
|
|
commands.EditLevel,
|
|
commands.EditDoodad,
|
|
commands.InstallScript,
|
|
commands.LevelPack,
|
|
}
|
|
|
|
sort.Sort(cli.FlagsByName(app.Flags))
|
|
sort.Sort(cli.CommandsByName(app.Commands))
|
|
|
|
err := app.Run(os.Args)
|
|
if err != nil {
|
|
log.Error("Fatal: %s", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|