mirror of
https://gitlab.com/EternalWanderer/sheet-parser.git
synced 2024-11-28 21:13:51 +01:00
More usage information
This commit is contained in:
parent
48b0972f30
commit
66f1e9efce
33
main.go
33
main.go
|
@ -12,23 +12,28 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
path, skillString, saveString, statString string
|
path, skillString, saveString, statString string
|
||||||
modifier, diceThrows, surfaces int
|
modifier, diceThrows, surfaces int
|
||||||
X, Y int
|
X, Y int
|
||||||
char Character
|
char Character
|
||||||
skillMap = make(map[string]int)
|
skillMap = make(map[string]int)
|
||||||
statMap = make(map[string]int)
|
statMap = make(map[string]int)
|
||||||
advantage, disadvantage bool
|
advantage, disadvantage, stat_list, skill_list bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseFlags() {
|
func parseFlags() {
|
||||||
flag.StringVar(&path, "file", "stats.json", "fock me")
|
flag.StringVar(&path, "file", "stats.json", "Used to point to character sheet")
|
||||||
flag.StringVar(&path, "f", "stats.json", "fock me")
|
flag.StringVar(&path, "f", "stats.json", "Used to point to character sheet")
|
||||||
flag.StringVar(&skillString, "skill", "", "Skill to parse")
|
flag.StringVar(&skillString, "skill", "", "Skill to parse")
|
||||||
flag.StringVar(&statString, "stat", "", "Stat check")
|
flag.StringVar(&statString, "stat", "", "Stat check")
|
||||||
flag.StringVar(&saveString, "save", "", "Saving throw to... throw")
|
flag.StringVar(&saveString, "save", "", "Saving throw to... throw")
|
||||||
|
|
||||||
flag.BoolVar(&advantage, "advantage", advantage, "Roll with advantage")
|
flag.BoolVar(&advantage, "advantage", advantage, "Roll with advantage")
|
||||||
flag.BoolVar(&disadvantage, "disadvantage", disadvantage, "Roll with disadvantage")
|
flag.BoolVar(&disadvantage, "disadvantage", disadvantage, "Roll with disadvantage")
|
||||||
|
|
||||||
|
flag.BoolVar(&stat_list, "stat-list", false, "Print list of stats, can also be used with -save flag")
|
||||||
|
flag.BoolVar(&skill_list, "skill-list", false, "Print list of skills to be used in combination with the -skill flag")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +72,14 @@ func main() {
|
||||||
initMaps()
|
initMaps()
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
case stat_list:
|
||||||
|
for i := 0; i < len(char.Stats); i++ {
|
||||||
|
fmt.Println(char.Stats[i].StatName)
|
||||||
|
}
|
||||||
|
case skill_list:
|
||||||
|
for i := 0; i < len(char.Skills); i++ {
|
||||||
|
fmt.Println(char.Skills[i].SkillName)
|
||||||
|
}
|
||||||
case advantage && disadvantage:
|
case advantage && disadvantage:
|
||||||
fmt.Println("You can't roll with both advantage and disadvantage")
|
fmt.Println("You can't roll with both advantage and disadvantage")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -116,7 +129,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fmt.Println("bollock")
|
flag.Usage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue