Beta Release

This commit is contained in:
2020-10-16 15:39:07 -05:00
parent c1f7e8ae91
commit 5f07ea41d2
5 changed files with 162 additions and 8 deletions
+11 -4
View File
@@ -20,6 +20,7 @@ const (
MODE_EDIT_HOLD
MODE_LIST_QUESTS
MODE_LIST_SHIPS
MODE_OUTPUT_HOLD_VALUE
)
type AppState struct {
@@ -49,13 +50,14 @@ func NewApp() *AppState {
func (a *AppState) initialize() error {
flag.StringVar(&a.ConfDir, "d", ".ncpt", "The configuration directory to use")
flag.BoolVar(&a.Verbose, "v", false, "Run in Verbose mode")
validateQuest := flag.String("c", "", "Validate the given quest is _c_orrect")
validateShip := flag.String("C", "", "Validate the given ship is _C_orrect")
validateQuest := flag.String("c", "", "Validate that the given quest is _c_orrect")
validateShip := flag.String("C", "", "Validate that the given ship is _C_orrect")
editQuest := flag.String("e", "", "Edit the given quest")
editShip := flag.String("E", "", "Edit the given ship")
listQuestsMode := flag.Bool("l", false, "List all available Quests")
listShipsMode := flag.Bool("L", false, "List all available Ships")
listQuestsMode := flag.Bool("l", false, "List available Quests")
listShipsMode := flag.Bool("L", false, "List available Ships")
editHold := flag.String("H", "", "Edit the hold for the given ship")
outputHoldValue := flag.String("h", "", "Output the given value from the given ship's hold")
flag.Parse()
a.Parms = flag.Args()
@@ -87,6 +89,9 @@ func (a *AppState) initialize() error {
} else if *editHold != "" {
a.Mode = MODE_EDIT_HOLD
a.Ship = data.NewShip(a.ConfDir, *editHold)
} else if *outputHoldValue != "" {
a.Mode = MODE_OUTPUT_HOLD_VALUE
a.Ship = data.NewShip(a.ConfDir, *outputHoldValue)
} else {
a.Mode = MODE_RUN
}
@@ -111,6 +116,8 @@ func (a *AppState) run() int {
return a.listQuests(a.Parms)
case MODE_LIST_SHIPS:
return a.listShips(a.Parms)
case MODE_OUTPUT_HOLD_VALUE:
return a.outputHoldValue(a.Parms)
default:
return a.runQuest(a.Parms)