printer/plainprinter.go
changeset 152 4397b8c740e5
parent 150 7f46bcaf240c
child 162 3118ab97c8df
equal deleted inserted replaced
151:466aabf6c90a 152:4397b8c740e5
    43 	}
    43 	}
    44 	switch o := obj.(type) {
    44 	switch o := obj.(type) {
    45 	case []madon.Account, []madon.Attachment, []madon.Card, []madon.Context,
    45 	case []madon.Account, []madon.Attachment, []madon.Card, []madon.Context,
    46 		[]madon.Instance, []madon.Mention, []madon.Notification,
    46 		[]madon.Instance, []madon.Mention, []madon.Notification,
    47 		[]madon.Relationship, []madon.Report, []madon.Results,
    47 		[]madon.Relationship, []madon.Report, []madon.Results,
    48 		[]madon.Status, []madon.StreamEvent, []madon.Tag,
    48 		[]madon.Status, []madon.StreamEvent, []madon.Tag, []madon.DomainName,
    49 		[]*gomif.InstanceStatus:
    49 		[]*gomif.InstanceStatus:
    50 		return p.plainForeach(o, w, initialIndent)
    50 		return p.plainForeach(o, w, initialIndent)
       
    51 	case *madon.DomainName:
       
    52 		return p.plainPrintDomainName(o, w, initialIndent)
       
    53 	case madon.DomainName:
       
    54 		return p.plainPrintDomainName(&o, w, initialIndent)
    51 	case *madon.Account:
    55 	case *madon.Account:
    52 		return p.plainPrintAccount(o, w, initialIndent)
    56 		return p.plainPrintAccount(o, w, initialIndent)
    53 	case madon.Account:
    57 	case madon.Account:
    54 		return p.plainPrintAccount(&o, w, initialIndent)
    58 		return p.plainPrintAccount(&o, w, initialIndent)
    55 	case *madon.Attachment:
    59 	case *madon.Attachment:
   152 		return
   156 		return
   153 	}
   157 	}
   154 	fmt.Fprintf(w, "%s%s: %s\n", prefix, label, value)
   158 	fmt.Fprintf(w, "%s%s: %s\n", prefix, label, value)
   155 }
   159 }
   156 
   160 
       
   161 func (p *PlainPrinter) plainPrintDomainName(d *madon.DomainName, w io.Writer, indent string) error {
       
   162 	indentedPrint(w, indent, true, false, "Domain Name", "%s", string(*d))
       
   163 	return nil
       
   164 }
       
   165 
   157 func (p *PlainPrinter) plainPrintAccount(a *madon.Account, w io.Writer, indent string) error {
   166 func (p *PlainPrinter) plainPrintAccount(a *madon.Account, w io.Writer, indent string) error {
   158 	indentedPrint(w, indent, true, false, "Account ID", "%d (%s)", a.ID, a.Username)
   167 	indentedPrint(w, indent, true, false, "Account ID", "%d (%s)", a.ID, a.Username)
   159 	indentedPrint(w, indent, false, false, "User ID", "%s", a.Acct)
   168 	indentedPrint(w, indent, false, false, "User ID", "%s", a.Acct)
   160 	indentedPrint(w, indent, false, false, "Display name", "%s", a.DisplayName)
   169 	indentedPrint(w, indent, false, false, "Display name", "%s", a.DisplayName)
   161 	indentedPrint(w, indent, false, false, "Creation date", "%v", a.CreatedAt.Local())
   170 	indentedPrint(w, indent, false, false, "Creation date", "%v", a.CreatedAt.Local())