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-10 00:35:44 +00:00
|
|
|
doodle "git.kirsle.net/apps/doodle/pkg"
|
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-10 02:17:56 +00:00
|
|
|
app.Version = fmt.Sprintf("%s build %s. Built on %s",
|
|
|
|
doodle.Version,
|
|
|
|
Build,
|
|
|
|
BuildDate,
|
|
|
|
)
|
2018-10-16 16:20:25 +00:00
|
|
|
|
|
|
|
app.Flags = []cli.Flag{
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "debug, d",
|
|
|
|
Usage: "enable debug level logging",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
app.Commands = []cli.Command{
|
|
|
|
commands.Convert,
|
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)
|
|
|
|
}
|
|
|
|
}
|