diff options
Diffstat (limited to '')
-rw-r--r-- | main.go | 33 | ||||
-rw-r--r-- | template.go | 2 | ||||
-rw-r--r-- | types.go | 6 |
3 files changed, 21 insertions, 20 deletions
@@ -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 } @@ -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 |