Add exposed versions of getTemplate and runTemplate

GetTemplate and RunTemplate allow external users to access the template system,
and in particular allow them to provide their own Buffer to write the output to.

I've implemented exposed versions calling the private functions, rather than breaking
the internal API. If this isn't a concern, we should remove getTemplate and runTemplate
in a future commit.
This commit is contained in:
Mike Pountney
2015-12-31 12:03:22 -08:00
parent 408743b3df
commit da6cbd5021
2 changed files with 8 additions and 1 deletions
+4
View File
@@ -177,6 +177,10 @@ func (c *Cli) makeRequest(req *http.Request) (resp *http.Response, err error) {
return resp, nil
}
func (c *Cli) GetTemplate(name string) string {
return c.getTemplate(name)
}
func (c *Cli) getTemplate(name string) string {
if override, ok := c.opts["template"].(string); ok {
if _, err := os.Stat(override); err == nil {