fix: add --version flag and correct ldflags module path
- Add --version flag to CLI (closes bd-bxt) - Fix ldflags module path: csv2excel/internal/version → code.beautifulmachines.dev/jakoubek/csv2excel/internal/version so build info (version, commit, date) is actually embedded into the binary - Add mg.Deps(Build) to Install so it always builds before installing
This commit is contained in:
parent
cd2bd65b79
commit
3c2c3cef57
2 changed files with 10 additions and 1 deletions
8
main.go
8
main.go
|
|
@ -12,14 +12,22 @@ import (
|
|||
"github.com/xuri/excelize/v2"
|
||||
"golang.org/x/text/encoding/charmap"
|
||||
"golang.org/x/text/transform"
|
||||
|
||||
"code.beautifulmachines.dev/jakoubek/csv2excel/internal/version"
|
||||
)
|
||||
|
||||
func main() {
|
||||
sep := flag.String("sep", "auto", "Trennzeichen: auto, ',', ';', '\\t'")
|
||||
enc := flag.String("enc", "utf8", "Encoding: utf8, windows1252")
|
||||
out := flag.String("o", "output.xlsx", "Ausgabedatei")
|
||||
showVersion := flag.Bool("version", false, "Version anzeigen")
|
||||
flag.Parse()
|
||||
|
||||
if *showVersion {
|
||||
fmt.Printf("csv2excel %s (commit %s, built %s)\n", version.Version, version.Commit, version.BuildDate)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
files := flag.Args()
|
||||
if len(files) == 0 {
|
||||
fmt.Fprintln(os.Stderr, "Verwendung: csv2xlsx [flags] datei1.csv datei2.csv ...")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue