From 9e3b1f6cce34a327814e46fe17255f569d5db374 Mon Sep 17 00:00:00 2001 From: Ivar Fatland Date: Mon, 15 Sep 2025 22:58:28 +0200 Subject: [PATCH] some progress --- v2/parse.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/v2/parse.go b/v2/parse.go index 66c5d8c..3adb6b7 100644 --- a/v2/parse.go +++ b/v2/parse.go @@ -1,9 +1,11 @@ package dimcli import ( - "fmt" "errors" + "fmt" + "os" "reflect" + "slices" ) type dummy struct {} @@ -48,6 +50,19 @@ func FullTypeNameFor[T any]() string { } func Parse[T any]() func() error { + var args = os.Args[1:] + var curr = reflect.TypeFor[T]() + for _, arg := range args { + var currFields = reflect.VisibleFields(curr) + var idx = slices.IndexFunc( currFields, func(f reflect.StructField) bool { + return f.Name == arg + }) + if idx == -1 { + panic("TODO") + } + } + // TODO print the names of the fields and a help-message + return func() error { return errors.New("TODO")