More trivia fields

This commit is contained in:
Nox Sluijtman 2022-08-22 15:17:58 +02:00
parent 095b4a7b45
commit 3fdb5f2591
6 changed files with 32 additions and 17 deletions

View file

@ -1,8 +1,8 @@
# Contributor: Marty Sluijtman <marty.wanderer@disroot.org>
# Maintainer: Marty Sluijtman <marty.wanderer@disroot.org>
pkgname=sheet-parser
pkgver=0.1
pkgrel=4
pkgver=0.2
pkgrel=0
pkgdesc="A little D&D character sheet parser written in go"
url="https://gitlab.com/EternalWanderer/sheet-parser"
arch="all"
@ -28,7 +28,7 @@ package() {
}
sha512sums="
72039de0cb1faab57ac1d9c7118dd84517f020277d93f71168b0cc74012a0910932b75d241f7d45c1b1cf7a66f0c010568beb41f66f59c8a4dae2e2afe8f8154 sheet-parser-0.1.tar.gz
3e990e0e2aac58d0498d3fbb42e2a03bfee5c6614bdc5e258c2723ef24eb2c0e6ff96e696f3f7552a35bb3d8e9070635f38f37ecf26069a0ad2800e3732f73a4 zsh.completion
71177c48d8337abf048a7eaa924cb2f0ec0fc547f58ea2a2dd64ce4d549b39cfc1aa9cea369cd440fece484d32b8e09fccb9e5d402688b738df274d069b5fc93 example.json
35eec80feaa09c683759f996c8ad11f0c70a178fcae165a8921b58e4b3afbe8b6c92cc4000f084237cc1b80c6b7196035495227a6f689c081123159ea9c4ad62 sheet-parser-0.2.tar.gz
c772f393191ebd3b68b0c08cc916b1605ce8bd7d7f458da58f00cfbb6120bebe7bc86d3b70a3f7bacc4eac05cfd33846fd7ec757c054018f25d629f88bd6fec0 zsh.completion
7c1f79d8c4348a7928f81064f29fe52b8475a573e8a14d3d6bd448453b0501af60c03b43301b7049bcc249661e66213f3365ac8d34ca5c52be1cbbd7278c6f8c example.json
"

View file

@ -1,4 +1,4 @@
VERSION = 0.1
VERSION = 0.2
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
ZSH_COMPLETION_OUTPUT := zsh.completion

View file

@ -1,7 +1,10 @@
{
"misc":{
"level": 1,
"name": "Bob"
"name": "Bob",
"race": "Human",
"class": "Figher",
"background": "Generic"
},
"stats":[
{"statName":"strength", "score":20, "proficient":false },

View file

@ -19,7 +19,7 @@ var (
char Character
skillMap = make(map[string]int)
statMap = make(map[string]int)
advantage, disadvantage, stat_list, skill_list, verbose bool
advantage, disadvantage, stat_list, skill_list, verbose, trivia bool
)
func parseFlags() {
@ -37,6 +37,9 @@ func parseFlags() {
flag.BoolVar(&verbose, "verbose", false, "Print stat numbers, to be used in combination with -stat-list or -skill-list")
flag.BoolVar(&verbose, "v", false, "Print stat numbers, to be used in combination with -stat-list or -skill-list")
flag.BoolVar(&trivia, "t", false, "Print character name, level and proficiency")
flag.BoolVar(&trivia, "trivia", false, "Print character name, level and proficiency")
flag.Parse()
}
@ -76,6 +79,10 @@ func main() {
switch {
case trivia:
fmt.Printf("Name: %s\tLevel: %d\tProficiency: %d\n", char.Misc.Name, char.Misc.Level, getProficiency())
fmt.Printf("Race: %s\tClass: %s\tBackground: %s\n", char.Misc.Race, char.Misc.Class, char.Misc.Background)
case stat_list && verbose:
var proficiency string
for i := 0; i < len(char.Stats); i++ {

View file

@ -9,6 +9,9 @@ type Character struct {
type Misc struct {
Level int `json:"level"`
Name string `json:"name"`
Race string `json:"race"`
Class string `json:"class"`
Background string `json:"background"`
}
type Skill struct {
SkillName string `json:"skillName"`

View file

@ -1,6 +1,8 @@
#compdef sheet-parser
arguments=(
'(--trivia -t)--trivia[Print character trivia]'
'(--trivia -t)-t[Print character trivia]'
'(--file)-f=[Path to charactersheet]:character sheet:_files -g "*.(json)(-.)"'
'(-f)--file=[Path to charactersheet]:character sheet:_files -g "*.(json)(-.)"'
'(--save --stat --verbose)-v[To be used in conjuction with list parameters]'