Browse Source

pub/failure: wrap preview/string

Benton Edmondson 1 year ago
parent
commit
1dc4904b44
5 changed files with 2 additions and 17 deletions
  1. 0 4
      pub/activity.go
  2. 0 4
      pub/actor.go
  3. 2 3
      pub/failure.go
  4. 0 2
      pub/interfaces.go
  5. 0 4
      pub/post.go

+ 0 - 4
pub/activity.go

@@ -58,10 +58,6 @@ func NewActivityFromObject(o object.Object, id *url.URL) (*Activity, error) {
 	return a, nil
 }
 
-func (a *Activity) Kind() string {
-	return a.kind
-}
-
 func (a *Activity) header(width int) string {
 	if a.kind == "Create" {
 		return ""

+ 0 - 4
pub/actor.go

@@ -73,10 +73,6 @@ func NewActorFromObject(o object.Object, id *url.URL) (*Actor, error) {
 	return a, nil
 }
 
-func (a *Actor) Kind() string {
-	return a.kind
-}
-
 func (a *Actor) Parents(quantity uint) ([]Tangible, Tangible) {
 	return []Tangible{}, nil
 }

+ 2 - 3
pub/failure.go

@@ -4,6 +4,7 @@ import (
 	"servitor/mime"
 	"servitor/style"
 	"time"
+	"servitor/ansi"
 )
 
 type Failure struct {
@@ -17,14 +18,12 @@ func NewFailure(err error) *Failure {
 	return &Failure{err}
 }
 
-func (f *Failure) Kind() string { return "failure" }
-
 func (f *Failure) Name() string {
 	return style.Problem(f.message)
 }
 
 func (f *Failure) Preview(width int) string {
-	return f.Name()
+	return ansi.Wrap(f.Name(), width)
 }
 
 func (f *Failure) String(width int) string {

+ 0 - 2
pub/interfaces.go

@@ -8,8 +8,6 @@ import (
 type Any any
 
 type Tangible interface {
-	Kind() string
-
 	String(width int) string
 	Preview(width int) string
 	Parents(quantity uint) ([]Tangible, Tangible)

+ 0 - 4
pub/post.go

@@ -94,10 +94,6 @@ func NewPostFromObject(o object.Object, id *url.URL) (*Post, error) {
 	return p, nil
 }
 
-func (p *Post) Kind() string {
-	return p.kind
-}
-
 func (p *Post) Children() Container {
 	/* the if is necessary because my understanding is
 	the first nil is a (*Collection)(nil) whereas