summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2022-01-24 22:23:12 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2022-01-24 22:23:12 +0100
commitab525a79df93487bea24cdbc6caabac8a3bdded2 (patch)
treea2478247b448dac18fe60274b1894dd39c8d3f11
parent89d6e3d79f4f97a9b49d1b90eae84b00fecd592e (diff)
downloadengarde-importer-ab525a79df93487bea24cdbc6caabac8a3bdded2.tar.gz
engarde-importer-ab525a79df93487bea24cdbc6caabac8a3bdded2.tar.bz2
engarde-importer-ab525a79df93487bea24cdbc6caabac8a3bdded2.zip
Export ALL the fields
Diffstat (limited to '')
-rw-r--r--main.go33
-rw-r--r--template.go2
-rw-r--r--types.go6
3 files changed, 21 insertions, 20 deletions
diff --git a/main.go b/main.go
index d0fd2b4..d8a0f8d 100644
--- a/main.go
+++ b/main.go
@@ -14,7 +14,7 @@ import (
//goland:noinspection GoUnusedType
type engarde interface {
- engarde() (string, error)
+ Engarde() (string, error)
}
type participant struct {
@@ -34,9 +34,9 @@ type club struct {
id uint
}
-func (p participant) engarde() (string, error) {
+func (p participant) Engarde() (string, error) {
name := strings.ToUpper(p.LastName)
- gender, err := p.Gender.engarde()
+ gender, err := p.Gender.Engarde()
if err != nil {
return "", err
}
@@ -48,7 +48,7 @@ func (p participant) engarde() (string, error) {
`, gender, name, p.FirstName, p.id, p.club.id), nil
}
-func (c club) engarde() (string, error) {
+func (c club) Engarde() (string, error) {
return fmt.Sprintf(`
{[classe club] [nom "%s"] [modifie vrai] [date_oed "332"] [cle %d]}`, c.name, c.id), nil
}
@@ -118,31 +118,32 @@ func usage() string {
}
type EngardeConfig struct {
- inputFile string
- outputDir string
- name string
- gender Gender
- ageGroup AgeGroup
- weapon Weapon
- date time.Time
+ inputFile string
+ outputDir string
+ Name string
+ Description string
+ Gender Gender
+ AgeGroup AgeGroup
+ Weapon Weapon
+ Date time.Time
}
func parseArgs() (config EngardeConfig, err error) {
config.inputFile = os.Args[1]
config.outputDir = os.Args[2]
- config.name = os.Args[3]
+ config.Name = os.Args[3]
- if config.gender, err = GenderFromString(os.Args[4]); err != nil {
+ if config.Gender, err = GenderFromString(os.Args[4]); err != nil {
return EngardeConfig{}, err
}
- if config.ageGroup, err = AgeGroupFromString(os.Args[5]); err != nil {
+ if config.AgeGroup, err = AgeGroupFromString(os.Args[5]); err != nil {
return EngardeConfig{}, err
}
- if config.weapon, err = WeaponFromString(os.Args[6]); err != nil {
+ if config.Weapon, err = WeaponFromString(os.Args[6]); err != nil {
return EngardeConfig{}, err
}
- if config.date, err = time.Parse("02.01.2006", os.Args[7]); err != nil {
+ if config.Date, err = time.Parse("02.01.2006", os.Args[7]); err != nil {
return EngardeConfig{}, err
}
diff --git a/template.go b/template.go
index 1e43f08..aa16727 100644
--- a/template.go
+++ b/template.go
@@ -103,7 +103,7 @@ func writeEngarde(outputDir, fileName string, entries []engarde) error {
encodedOutput := encodedWriter(output)
for _, entry := range entries {
- str, err := entry.engarde()
+ str, err := entry.Engarde()
if err != nil {
return err
}
diff --git a/types.go b/types.go
index 8c1538e..01c8b5e 100644
--- a/types.go
+++ b/types.go
@@ -20,7 +20,7 @@ func (g Gender) String() string {
}
}
-func (g Gender) engarde() (string, error) {
+func (g Gender) Engarde() (string, error) {
switch g {
case GenderM:
return "masculin", nil
@@ -69,7 +69,7 @@ func (a AgeGroup) String() string {
}
}
-func (a AgeGroup) engarde() (string, error) {
+func (a AgeGroup) Engarde() (string, error) {
switch a {
case AgeVeteran:
return "veteran", nil
@@ -112,7 +112,7 @@ func (w Weapon) String() string {
}
}
-func (w Weapon) engarde() (string, error) {
+func (w Weapon) Engarde() (string, error) {
switch w {
case Epee:
return "epee", nil