added main, there should be a seperate cmd, will do later

This commit is contained in:
2025-07-31 15:57:08 +02:00
parent 8c13b4c85c
commit a9678225fd

View File

@@ -1,9 +1,11 @@
package slownie
package main
import (
"errors"
"fmt"
"math"
"os"
"strconv"
"strings"
)
@@ -144,3 +146,16 @@ func KwotaSlownie(input float64, numbers bool) (output string, err error) {
return minusword + someSlownie(zloty, _zlotyWord) + " " + someSlownie(grosze, _groszyWord), nil
}
func main() {
arg := os.Args[1]
if s, err := strconv.ParseFloat(arg, 32); err == nil {
if words, err := KwotaSlownie(s, true); err == nil {
fmt.Printf("slownie: %s\n", words)
} else {
println("error during processing")
}
} else {
println("error reading input")
}
}