@@ -54,9 +54,10 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
5454 return nil
5555 }
5656
57+ templateFlags , toJSON , fromJSON , processTemplate := base .TemplateProcessor (plugins )
58+
5759 ///////////////////////////////////////////////////////////////////////////////////
5860 // commit
59- commitTemplateFlags , toJSON , _ , commitProcessTemplate := base .TemplateProcessor (plugins )
6061 commit := & cobra.Command {
6162 Use : "commit <template URL>" ,
6263 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 {
6869
6970 view , err := base .ReadFromStdinIfElse (
7071 func () bool { return args [0 ] == "-" },
71- func () (string , error ) { return commitProcessTemplate (args [0 ]) },
72+ func () (string , error ) { return processTemplate (args [0 ]) },
7273 toJSON ,
7374 )
7475 if err != nil {
@@ -91,16 +92,15 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
9192 return err
9293 },
9394 }
94- commit .Flags ().AddFlagSet (commitTemplateFlags )
95+ commit .Flags ().AddFlagSet (templateFlags )
9596
9697 ///////////////////////////////////////////////////////////////////////////////////
9798 // destroy
98- destroyTemplateFlags , toJSON , _ , destroyProcessTemplate := base .TemplateProcessor (plugins )
9999 destroy := & cobra.Command {
100100 Use : "destroy <template URL>" ,
101101 Short : "Destroy a resource configuration specified by the URL. Read from stdin if url is '-'" ,
102102 }
103- destroy .Flags ().AddFlagSet (destroyTemplateFlags )
103+ destroy .Flags ().AddFlagSet (templateFlags )
104104 destroy .RunE = func (cmd * cobra.Command , args []string ) error {
105105
106106 if len (args ) != 1 {
@@ -110,7 +110,7 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
110110
111111 view , err := base .ReadFromStdinIfElse (
112112 func () bool { return args [0 ] == "-" },
113- func () (string , error ) { return destroyProcessTemplate (args [0 ]) },
113+ func () (string , error ) { return processTemplate (args [0 ]) },
114114 toJSON ,
115115 )
116116 if err != nil {
@@ -135,7 +135,6 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
135135
136136 ///////////////////////////////////////////////////////////////////////////////////
137137 // describe
138- describeTemplateFlags , toJSON , fromJSON , describeProcessTemplate := base .TemplateProcessor (plugins )
139138 describe := & cobra.Command {
140139 Use : "describe <template URL>" ,
141140 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 {
148147
149148 view , err := base .ReadFromStdinIfElse (
150149 func () bool { return args [0 ] == "-" },
151- func () (string , error ) { return describeProcessTemplate (args [0 ]) },
150+ func () (string , error ) { return processTemplate (args [0 ]) },
152151 toJSON ,
153152 )
154153 if err != nil {
@@ -175,7 +174,7 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {
175174 return err
176175 },
177176 }
178- describe .Flags ().AddFlagSet (describeTemplateFlags )
177+ describe .Flags ().AddFlagSet (templateFlags )
179178
180179 cmd .AddCommand (
181180 commit ,
0 commit comments