@@ -54,9 +54,10 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
54
54
return nil
55
55
}
56
56
57
+ templateFlags , toJSON , fromJSON , processTemplate := base .TemplateProcessor (plugins )
58
+
57
59
///////////////////////////////////////////////////////////////////////////////////
58
60
// commit
59
- commitTemplateFlags , toJSON , _ , commitProcessTemplate := base .TemplateProcessor (plugins )
60
61
commit := & cobra.Command {
61
62
Use : "commit <template URL>" ,
62
63
Short : "Commit a resource configuration at url. Read from stdin if url is '-'" ,
@@ -68,7 +69,7 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
68
69
69
70
view , err := base .ReadFromStdinIfElse (
70
71
func () bool { return args [0 ] == "-" },
71
- func () (string , error ) { return commitProcessTemplate (args [0 ]) },
72
+ func () (string , error ) { return processTemplate (args [0 ]) },
72
73
toJSON ,
73
74
)
74
75
if err != nil {
@@ -91,16 +92,15 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
91
92
return err
92
93
},
93
94
}
94
- commit .Flags ().AddFlagSet (commitTemplateFlags )
95
+ commit .Flags ().AddFlagSet (templateFlags )
95
96
96
97
///////////////////////////////////////////////////////////////////////////////////
97
98
// destroy
98
- destroyTemplateFlags , toJSON , _ , destroyProcessTemplate := base .TemplateProcessor (plugins )
99
99
destroy := & cobra.Command {
100
100
Use : "destroy <template URL>" ,
101
101
Short : "Destroy a resource configuration specified by the URL. Read from stdin if url is '-'" ,
102
102
}
103
- destroy .Flags ().AddFlagSet (destroyTemplateFlags )
103
+ destroy .Flags ().AddFlagSet (templateFlags )
104
104
destroy .RunE = func (cmd * cobra.Command , args []string ) error {
105
105
106
106
if len (args ) != 1 {
@@ -110,7 +110,7 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
110
110
111
111
view , err := base .ReadFromStdinIfElse (
112
112
func () bool { return args [0 ] == "-" },
113
- func () (string , error ) { return destroyProcessTemplate (args [0 ]) },
113
+ func () (string , error ) { return processTemplate (args [0 ]) },
114
114
toJSON ,
115
115
)
116
116
if err != nil {
@@ -135,7 +135,6 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
135
135
136
136
///////////////////////////////////////////////////////////////////////////////////
137
137
// describe
138
- describeTemplateFlags , toJSON , fromJSON , describeProcessTemplate := base .TemplateProcessor (plugins )
139
138
describe := & cobra.Command {
140
139
Use : "describe <template URL>" ,
141
140
Short : "Describe a resource configuration specified by the URL. Read from stdin if url is '-'" ,
@@ -148,7 +147,7 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
148
147
149
148
view , err := base .ReadFromStdinIfElse (
150
149
func () bool { return args [0 ] == "-" },
151
- func () (string , error ) { return describeProcessTemplate (args [0 ]) },
150
+ func () (string , error ) { return processTemplate (args [0 ]) },
152
151
toJSON ,
153
152
)
154
153
if err != nil {
@@ -175,7 +174,7 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
175
174
return err
176
175
},
177
176
}
178
- describe .Flags ().AddFlagSet (describeTemplateFlags )
177
+ describe .Flags ().AddFlagSet (templateFlags )
179
178
180
179
cmd .AddCommand (
181
180
commit ,
0 commit comments