in ctc_lib/container_tool_list_command.go [54:77]
func (commandList ContainerToolListCommand) ReadFromStream(streamOutput bool) ([]interface{}, error) {
results := make([]interface{}, 0)
for obj := range commandList.Stream {
if _, ok := obj.(string); ok {
// Display any Arbitary strings written to the channel as is.
// These could be headers or any text.
// TODO: Provide a callback for users to overwrite this default behavior.
if streamOutput {
util.ExecuteTemplate(constants.EmptyTemplate,
obj, commandList.TemplateFuncMap, commandList.OutOrStdout())
}
continue
}
results = append(results, obj)
if streamOutput {
err := util.ExecuteTemplate(commandList.ReadTemplateFromFlagOrCmdDefault(),
obj, commandList.TemplateFuncMap, commandList.OutOrStdout())
if err != nil {
return nil, err
}
}
}
return results, nil
}