From dbb4a164c54c3eec7fec0b222146e83db37812b4 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Fri, 30 Dec 2022 23:21:46 +0100 Subject: [PATCH] Dangling --- Parser/Parser.go | 10 +++++----- main.go | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Parser/Parser.go b/Parser/Parser.go index ac096d4..f248b41 100644 --- a/Parser/Parser.go +++ b/Parser/Parser.go @@ -30,8 +30,8 @@ func handleError(err error) { } } -func readJson() { - envPath, isSet := os.LookupEnv("CHARSHEET") +func ReadJson(envVar string) { + envPath, isSet := os.LookupEnv(envVar) switch { case len(pathFlag) > 0: path = pathFlag @@ -142,7 +142,7 @@ func savingThrow(stat Stat) (int, int, error) { return die + GetModifier(stat), plainDie, statErrorCheck() } -func skillCheck(skill Skill) (int, int, error) { +func SkillCheck(skill Skill) (int, int, error) { die := rollDice() if char.Misc.ReliableTalent && skill.Proficient && die < 10 { die = 10 @@ -162,7 +162,7 @@ func skillCheck(skill Skill) (int, int, error) { return die, plainDie, skillErrorCheck() } -func printStatList(verbose bool) { +func PrintStatList(verbose bool) { color.Magenta("Listing stats...") if verbose { var proficiency string @@ -184,7 +184,7 @@ func printStatList(verbose bool) { } } -func printSkillList(verbose bool) { +func PrintSkillList(verbose bool) { color.Magenta("Listing skills...") var proficiency string var expertise string diff --git a/main.go b/main.go index 0a1a6a4..7ac62eb 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,7 @@ import ( "github.com/fatih/color" "gitlab.com/EternalWanderer/dice-roller/Dice" + "gitlab.com/EternalWanderer/sheet-parser/v2/Parser" ) const exampleFile string = "/etc/sheet-parser/example.json" @@ -88,7 +89,7 @@ func initMaps() { func main() { parseFlags() - readJson() + char := Parser.ReadJson("CHARSHEET") initMaps() switch {