// 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 }
// 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") }
func (s sessionV2) String() string { if !globalJSONFlag { message := console.SessionID("%s -> ", s.SessionID) message = message + console.Time("[%s]", s.Header.When.Local().Format(printDate)) message = message + console.Command(" %s %s", s.Header.CommandType, strings.Join(s.Header.CommandArgs, " ")) return message + "\n" } sessionMesage := SessionJSONMessage{ Version: s.Header.Version, SessionID: s.SessionID, Time: s.Header.When.Local().Format(printDate), CommandType: s.Header.CommandType, CommandArgs: s.Header.CommandArgs, } sessionJSONBytes, err := json.MarshalIndent(sessionMesage, "", "\t") if err != nil { panic(err) } return console.JSON(string(sessionJSONBytes) + "\n") }
func (s sessionV1) String() string { message := console.SessionID("%s -> ", s.SessionID) message = message + console.Time("[%s]", s.Started.Local().Format(printDate)) message = message + console.Command(" %s %s", s.CommandType, strings.Join(s.URLs, " ")) return message }