Beispiel #1
0
// String string printer for Content metadata
func (c Content) String() string {
	message := console.Time("[%s] ", c.Time)
	message = message + console.Size("%6s ", c.Size)
	message = func() string {
		if c.Filetype == "directory" {
			return message + console.Dir("%s", c.Name)
		}
		return message + console.File("%s", c.Name)
	}()
	return message
}
Beispiel #2
0
// String string printer for Content metadata
func (c Content) String() string {
	if !globalJSONFlag {
		message := console.Time("[%s] ", c.Time)
		message = message + console.Size("%6s ", c.Size)
		message = func() string {
			if c.Filetype == "folder" {
				return message + console.Dir("%s", c.Name)
			}
			return message + console.File("%s", c.Name)
		}()
		return message + "\n"
	}
	c.Version = "1.0.0"
	jsonMessageBytes, err := json.MarshalIndent(c, "", "\t")
	if err != nil {
		panic(err)
	}
	return console.JSON(string(jsonMessageBytes) + "\n")
}