~welt/murse

ref: toast murse/main.go -rw-r--r-- 1.0 KiB
6a4e2213welt Initial work on TVS support, and toaster. 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"os"

	"github.com/integrii/flaggy"
)

func main() {
	url := "https://toast.openfortress.fun/toast/"
	var dir string
	upgrade := flaggy.NewSubcommand("upgrade")
	upgrade.Description = "Upgrades your game files to the latest version."
	upgrade.String(&url, "u", "url", "url of tvs repository with a slash at the end, defaults to Open Fortress' servers.")
	upgrade.AddPositionalValue(&dir, "directory", 1, true, "directory to interact with")
	flaggy.AttachSubcommand(upgrade, 1)

	var tvsdir string
	toast := flaggy.NewSubcommand("toast")
	toast.Description = "Toasts files. Don't use this unless you know what you're doing."
	toast.AddPositionalValue(&dir, "game files", 1, true, "directory of game files to reference")
	toast.AddPositionalValue(&tvsdir, "tvs directory", 2, true, "directory of tvs to add changes to")
	flaggy.AttachSubcommand(toast, 1)

	flaggy.Parse()

	if upgrade.Used {
		os.Exit(upgradeMain(dir, url))
	}

	if toast.Used {
		os.Exit(toastMain(dir, tvsdir))
	}

	flaggy.ShowHelp("Please choose a subcommand.")
	os.Exit(1)
}