summaryrefslogtreecommitdiff
path: root/order/order.go
diff options
context:
space:
mode:
Diffstat (limited to 'order/order.go')
-rw-r--r--order/order.go13
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
}