printer/plainprinter.go
changeset 210 94be15243195
parent 207 56afbe03a7d4
child 228 360929ee6aef
equal deleted inserted replaced
209:3772cc6b3d0a 210:94be15243195
    43 	case []madon.Account, []madon.Attachment, []madon.Card, []madon.Context,
    43 	case []madon.Account, []madon.Attachment, []madon.Card, []madon.Context,
    44 		[]madon.Emoji, []madon.Instance, []madon.InstancePeer,
    44 		[]madon.Emoji, []madon.Instance, []madon.InstancePeer,
    45 		[]madon.List, []madon.Mention, []madon.Notification,
    45 		[]madon.List, []madon.Mention, []madon.Notification,
    46 		[]madon.Relationship, []madon.Report, []madon.Results,
    46 		[]madon.Relationship, []madon.Report, []madon.Results,
    47 		[]madon.Status, []madon.StreamEvent, []madon.Tag,
    47 		[]madon.Status, []madon.StreamEvent, []madon.Tag,
    48 		[]madon.DomainName:
    48 		[]madon.WeekActivity, []madon.DomainName:
    49 		return p.plainForeach(o, w, initialIndent)
    49 		return p.plainForeach(o, w, initialIndent)
    50 	case *madon.DomainName:
    50 	case *madon.DomainName:
    51 		return p.plainPrintDomainName(o, w, initialIndent)
    51 		return p.plainPrintDomainName(o, w, initialIndent)
    52 	case madon.DomainName:
    52 	case madon.DomainName:
    53 		return p.plainPrintDomainName(&o, w, initialIndent)
    53 		return p.plainPrintDomainName(&o, w, initialIndent)
   105 		return p.plainPrintStatus(&o, w, initialIndent)
   105 		return p.plainPrintStatus(&o, w, initialIndent)
   106 	case *madon.UserToken:
   106 	case *madon.UserToken:
   107 		return p.plainPrintUserToken(o, w, initialIndent)
   107 		return p.plainPrintUserToken(o, w, initialIndent)
   108 	case madon.UserToken:
   108 	case madon.UserToken:
   109 		return p.plainPrintUserToken(&o, w, initialIndent)
   109 		return p.plainPrintUserToken(&o, w, initialIndent)
       
   110 	case *madon.WeekActivity:
       
   111 		return p.plainPrintWeekActivity(o, w, initialIndent)
       
   112 	case madon.WeekActivity:
       
   113 		return p.plainPrintWeekActivity(&o, w, initialIndent)
   110 	}
   114 	}
   111 	// TODO: Mention
   115 	// TODO: Mention
   112 	// TODO: StreamEvent
   116 	// TODO: StreamEvent
   113 	// TODO: Tag
   117 	// TODO: Tag
   114 
   118 
   375 		indentedPrint(w, indent, false, true, "Timestamp", "%v", time.Unix(s.CreatedAt, 0))
   379 		indentedPrint(w, indent, false, true, "Timestamp", "%v", time.Unix(s.CreatedAt, 0))
   376 	}
   380 	}
   377 	indentedPrint(w, indent, false, true, "Scope", "%s", s.Scope)
   381 	indentedPrint(w, indent, false, true, "Scope", "%s", s.Scope)
   378 	return nil
   382 	return nil
   379 }
   383 }
       
   384 
       
   385 func (p *PlainPrinter) plainPrintWeekActivity(a *madon.WeekActivity, w io.Writer, indent string) error {
       
   386 	indentedPrint(w, indent, true, false, "Activity week", "%v", a.Week.Format("2006-01-02"))
       
   387 	indentedPrint(w, indent, false, true, "Weekly logins", "%d", a.Logins)
       
   388 	indentedPrint(w, indent, false, true, "Weekly statuses", "%d", a.Statuses)
       
   389 	indentedPrint(w, indent, false, true, "Weekly registrations", "%d", a.Registrations)
       
   390 	return nil
       
   391 }