mirror of
https://gitlab.com/EternalWanderer/sheet-parser.git
synced 2024-11-29 05:23:49 +01:00
More trivia fields
This commit is contained in:
parent
095b4a7b45
commit
3fdb5f2591
10
APKBUILD
10
APKBUILD
|
@ -1,8 +1,8 @@
|
||||||
# Contributor: Marty Sluijtman <marty.wanderer@disroot.org>
|
# Contributor: Marty Sluijtman <marty.wanderer@disroot.org>
|
||||||
# Maintainer: Marty Sluijtman <marty.wanderer@disroot.org>
|
# Maintainer: Marty Sluijtman <marty.wanderer@disroot.org>
|
||||||
pkgname=sheet-parser
|
pkgname=sheet-parser
|
||||||
pkgver=0.1
|
pkgver=0.2
|
||||||
pkgrel=4
|
pkgrel=0
|
||||||
pkgdesc="A little D&D character sheet parser written in go"
|
pkgdesc="A little D&D character sheet parser written in go"
|
||||||
url="https://gitlab.com/EternalWanderer/sheet-parser"
|
url="https://gitlab.com/EternalWanderer/sheet-parser"
|
||||||
arch="all"
|
arch="all"
|
||||||
|
@ -28,7 +28,7 @@ package() {
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="
|
sha512sums="
|
||||||
72039de0cb1faab57ac1d9c7118dd84517f020277d93f71168b0cc74012a0910932b75d241f7d45c1b1cf7a66f0c010568beb41f66f59c8a4dae2e2afe8f8154 sheet-parser-0.1.tar.gz
|
35eec80feaa09c683759f996c8ad11f0c70a178fcae165a8921b58e4b3afbe8b6c92cc4000f084237cc1b80c6b7196035495227a6f689c081123159ea9c4ad62 sheet-parser-0.2.tar.gz
|
||||||
3e990e0e2aac58d0498d3fbb42e2a03bfee5c6614bdc5e258c2723ef24eb2c0e6ff96e696f3f7552a35bb3d8e9070635f38f37ecf26069a0ad2800e3732f73a4 zsh.completion
|
c772f393191ebd3b68b0c08cc916b1605ce8bd7d7f458da58f00cfbb6120bebe7bc86d3b70a3f7bacc4eac05cfd33846fd7ec757c054018f25d629f88bd6fec0 zsh.completion
|
||||||
71177c48d8337abf048a7eaa924cb2f0ec0fc547f58ea2a2dd64ce4d549b39cfc1aa9cea369cd440fece484d32b8e09fccb9e5d402688b738df274d069b5fc93 example.json
|
7c1f79d8c4348a7928f81064f29fe52b8475a573e8a14d3d6bd448453b0501af60c03b43301b7049bcc249661e66213f3365ac8d34ca5c52be1cbbd7278c6f8c example.json
|
||||||
"
|
"
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
VERSION = 0.1
|
VERSION = 0.2
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
MANPREFIX = $(PREFIX)/share/man
|
MANPREFIX = $(PREFIX)/share/man
|
||||||
ZSH_COMPLETION_OUTPUT := zsh.completion
|
ZSH_COMPLETION_OUTPUT := zsh.completion
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{
|
{
|
||||||
"misc":{
|
"misc":{
|
||||||
"level": 1,
|
"level": 1,
|
||||||
"name": "Bob"
|
"name": "Bob",
|
||||||
|
"race": "Human",
|
||||||
|
"class": "Figher",
|
||||||
|
"background": "Generic"
|
||||||
},
|
},
|
||||||
"stats":[
|
"stats":[
|
||||||
{"statName":"strength", "score":20, "proficient":false },
|
{"statName":"strength", "score":20, "proficient":false },
|
||||||
|
|
23
main.go
23
main.go
|
@ -12,14 +12,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
path, skillString, saveString, statString string
|
path, skillString, saveString, statString string
|
||||||
exampleFile string = "/etc/sheet-parser/example.json"
|
exampleFile string = "/etc/sheet-parser/example.json"
|
||||||
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, stat_list, skill_list, verbose bool
|
advantage, disadvantage, stat_list, skill_list, verbose, trivia bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseFlags() {
|
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, "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(&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()
|
flag.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +79,10 @@ func main() {
|
||||||
|
|
||||||
switch {
|
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:
|
case stat_list && verbose:
|
||||||
var proficiency string
|
var proficiency string
|
||||||
for i := 0; i < len(char.Stats); i++ {
|
for i := 0; i < len(char.Stats); i++ {
|
||||||
|
|
|
@ -7,8 +7,11 @@ type Character struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Misc struct {
|
type Misc struct {
|
||||||
Level int `json:"level"`
|
Level int `json:"level"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
Race string `json:"race"`
|
||||||
|
Class string `json:"class"`
|
||||||
|
Background string `json:"background"`
|
||||||
}
|
}
|
||||||
type Skill struct {
|
type Skill struct {
|
||||||
SkillName string `json:"skillName"`
|
SkillName string `json:"skillName"`
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#compdef sheet-parser
|
#compdef sheet-parser
|
||||||
|
|
||||||
arguments=(
|
arguments=(
|
||||||
|
'(--trivia -t)--trivia[Print character trivia]'
|
||||||
|
'(--trivia -t)-t[Print character trivia]'
|
||||||
'(--file)-f=[Path to charactersheet]:character sheet:_files -g "*.(json)(-.)"'
|
'(--file)-f=[Path to charactersheet]:character sheet:_files -g "*.(json)(-.)"'
|
||||||
'(-f)--file=[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]'
|
'(--save --stat --verbose)-v[To be used in conjuction with list parameters]'
|
||||||
|
|
Loading…
Reference in a new issue