adding envs tagging/interpolation
This commit is contained in:
27
exec_extra/funcs_test.go
Normal file
27
exec_extra/funcs_test.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user