diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-29 01:59:23 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-29 01:59:23 +0200 |
| commit | 28e43c7356d796e18d2f818d100078c5aa31c14c (patch) | |
| tree | 023c7f4a9d192bcf4f16755307f43a622beb671d /order | |
| parent | 2b28ee919614d5ddaceda26ce488a0ca4c851cb3 (diff) | |
add executable runner
Diffstat (limited to 'order')
| -rw-r--r-- | order/order.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/order/order.go b/order/order.go index 40e6e73..83c7dcb 100644 --- a/order/order.go +++ b/order/order.go @@ -31,6 +31,7 @@ func FromFile(f fs.FS, path string) (Order, error) { } func FromReader(r io.Reader) (Order, error) { + o := &Order{} scanner := bufio.NewScanner(r) scanner.Split(bufio.ScanLines) for scanner.Scan() { @@ -45,6 +46,18 @@ func FromReader(r io.Reader) (Order, error) { continue } } + + spl := strings.SplitN(line, "#", 2) + + e := &Element{ + Identifier: identity.New(spl[0]), + } + if len(spl) > 1 { + e.Description = spl[1] + } + + o.Elements = append(o.Elements, *e) } + return *o, nil } |
