adding envs tagging/interpolation

This commit is contained in:
brent saner
2024-06-17 04:33:30 -04:00
parent eed9c34ebf
commit b64c318a4a
18 changed files with 734 additions and 1575 deletions

27
exec_extra/funcs_test.go Normal file
View File

@@ -0,0 +1,27 @@
package exec_extra
import (
`testing`
)
type (
testStruct struct {
Foo string `cmdarg:"short=f,long=foo"`
Bar int `cmdarg:"short=b,long=bar,prefer_short"`
}
)
func TestGetCmdFromStruct(t *testing.T) {
var err error
var out []string
var v *testStruct = &testStruct{
Foo: "foo",
Bar: 123,
}
if out, err = GetCmdFromStruct(v); err != nil {
t.Fatalf("Received error getting command from struct: %v", err)
}
t.Logf("Got command args from struct:\n%#v", out)
}