@@ -14,13 +14,31 @@ import (
1414 "github.com/spf13/cobra"
1515)
1616
17+ func buildExamplePropertyInput () string {
18+ return getExample (opslevel.PropertyInput {
19+ Definition : * opslevel .NewIdentifier ("example_definition" ),
20+ Owner : * opslevel .NewIdentifier ("example_owner" ),
21+ Value : opslevel .JsonString ("example_value" ),
22+ })
23+ }
24+
25+ func buildExamplePropertyDefinitionInput () string {
26+ return getExample (opslevel.PropertyDefinitionInput {
27+ Name : opslevel .RefOf ("example_name" ),
28+ Description : opslevel .RefOf ("example_description" ),
29+ Schema : & opslevel.JSONSchema {
30+ "type" : "string" ,
31+ },
32+ })
33+ }
34+
1735var examplePropertyCmd = & cobra.Command {
1836 Use : "property" ,
1937 Aliases : []string {"prop" },
2038 Short : "Example Property" ,
2139 Long : `Example Property` ,
2240 Run : func (cmd * cobra.Command , args []string ) {
23- fmt .Println (getExample [opslevel. PropertyInput ] ())
41+ fmt .Println (buildExamplePropertyInput ())
2442 },
2543}
2644
104122
105123cat << EOF | opslevel assign property -f -
106124%s
107- EOF` , getYaml [opslevel. PropertyInput ] ()),
125+ EOF` , buildExamplePropertyInput ()),
108126 Run : func (cmd * cobra.Command , args []string ) {
109127 input , err := readResourceInput [opslevel.PropertyInput ]()
110128 cobra .CheckErr (err )
@@ -149,7 +167,7 @@ var examplePropertyDefinitionCmd = &cobra.Command{
149167 Short : "Example Property Definition" ,
150168 Long : `Example Property Definition` ,
151169 Run : func (cmd * cobra.Command , args []string ) {
152- fmt .Println (getExample [opslevel. PropertyDefinitionInput ] ())
170+ fmt .Println (buildExamplePropertyDefinitionInput ())
153171 },
154172}
155173
@@ -161,7 +179,7 @@ var createPropertyDefinitionCmd = &cobra.Command{
161179 Example : fmt .Sprintf (`
162180cat << EOF | opslevel create property-definition -f -
163181%s
164- EOF` , getYaml [opslevel. PropertyDefinitionInput ] ()),
182+ EOF` , buildExamplePropertyDefinitionInput ()),
165183 Run : func (cmd * cobra.Command , args []string ) {
166184 input , err := readPropertyDefinitionInput ()
167185 cobra .CheckErr (err )
@@ -180,7 +198,7 @@ var updatePropertyDefinitionCmd = &cobra.Command{
180198 Example : fmt .Sprintf (`
181199cat << EOF | opslevel update property-definition propdef3 -f -
182200%s
183- EOF` , getYaml [opslevel. PropertyDefinitionInput ] ()),
201+ EOF` , buildExamplePropertyDefinitionInput ()),
184202 Args : cobra .ExactArgs (1 ),
185203 ArgAliases : []string {"ID" , "ALIAS" },
186204 Run : func (cmd * cobra.Command , args []string ) {
0 commit comments