2018-10-16 16:20:25 +00:00
|
|
|
// doodad is the command line developer tool for Doodle.
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2019-04-10 02:17:56 +00:00
|
|
|
"fmt"
|
2018-10-16 16:20:25 +00:00
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"sort"
|
2019-04-10 02:17:56 +00:00
|
|
|
"time"
|
2018-10-16 16:20:25 +00:00
|
|
|
|
|
|
|
"git.kirsle.net/apps/doodle/cmd/doodad/commands"
|
2019-04-20 00:23:37 +00:00
|
|
|
"git.kirsle.net/apps/doodle/pkg/balance"
|
2019-06-24 00:52:48 +00:00
|
|
|
"git.kirsle.net/apps/doodle/pkg/branding"
|
2018-10-16 16:20:25 +00:00
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
2019-04-10 02:17:56 +00:00
|
|
|
// Build variables.
|
|
|
|
var (
|
|
|
|
Build = "N/A"
|
|
|
|
BuildDate string
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
if BuildDate == "" {
|
|
|
|
BuildDate = time.Now().Format(time.RFC3339)
|
|
|
|
}
|
|
|
|
}
|
2018-10-16 16:20:25 +00:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := cli.NewApp()
|
|
|
|
app.Name = "doodad"
|
|
|
|
app.Usage = "command line interface for Doodle"
|
2019-04-20 00:23:37 +00:00
|
|
|
|
|
|
|
var freeLabel string
|
|
|
|
if balance.FreeVersion {
|
|
|
|
freeLabel = " (shareware)"
|
|
|
|
}
|
|
|
|
|
|
|
|
app.Version = fmt.Sprintf("%s build %s%s. Built on %s",
|
2019-06-24 00:52:48 +00:00
|
|
|
branding.Version,
|
2019-04-10 02:17:56 +00:00
|
|
|
Build,
|
2019-04-20 00:23:37 +00:00
|
|
|
freeLabel,
|
2019-04-10 02:17:56 +00:00
|
|
|
BuildDate,
|
|
|
|
)
|
2018-10-16 16:20:25 +00:00
|
|
|
|
|
|
|
app.Flags = []cli.Flag{
|
2020-06-05 06:11:03 +00:00
|
|
|
&cli.BoolFlag{
|
2018-10-16 16:20:25 +00:00
|
|
|
Name: "debug, d",
|
|
|
|
Usage: "enable debug level logging",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-06-05 06:11:03 +00:00
|
|
|
app.Commands = []*cli.Command{
|
2018-10-16 16:20:25 +00:00
|
|
|
commands.Convert,
|
2019-07-07 06:28:11 +00:00
|
|
|
commands.Show,
|
|
|
|
commands.EditLevel,
|
|
|
|
commands.EditDoodad,
|
2019-04-16 06:07:15 +00:00
|
|
|
commands.InstallScript,
|
2018-10-16 16:20:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sort.Sort(cli.FlagsByName(app.Flags))
|
|
|
|
sort.Sort(cli.CommandsByName(app.Commands))
|
|
|
|
|
|
|
|
err := app.Run(os.Args)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|