feat: initialer Commit des csv2excel CLI-Tools

Go-CLI-Tool zum Konvertieren von CSV-Dateien in Excel (.xlsx),
mit Mage-Build-System und Architektur-Dokumentation.
This commit is contained in:
Oliver Jakoubek 2026-03-05 10:14:52 +01:00
commit 26b874674f
10 changed files with 328 additions and 0 deletions

26
docs/architecture.md Normal file
View file

@ -0,0 +1,26 @@
# Architecture
## Overview
Single-file tool — entire application logic lives in `main.go`.
- **`main()`**: Parses flags (`-sep`, `-enc`, `-o`), iterates over input CSV files, creates one Excel sheet per file using the filename (without extension) as the sheet name, writes all rows, saves the output `.xlsx`.
- **`detectDelimiter()`**: Auto-detects the CSV delimiter by counting `;`, `,`, and `\t` occurrences in the first line. Falls back to `;` on error.
Key behaviors:
- Sheet names are truncated to 31 characters (Excel limit)
- Encoding `windows1252` wraps the file reader with a Windows-1252 decoder
- `csvReader.LazyQuotes = true` for tolerance with malformed CSV files
- The first sheet renames "Sheet1"; subsequent sheets are created fresh
## Version Injection
Version info is injected at build time via ldflags from git tags:
- `internal/version.Version` — from `git describe --tags --always`
- `internal/version.Commit` — from `git rev-parse --short HEAD`
- `internal/version.BuildDate` — from `date -u`
## Dependencies
- `github.com/xuri/excelize/v2` — Excel file creation/manipulation
- `golang.org/x/text` — Character encoding (Windows-1252 support)