output

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package output renders command results. Default is compact JSON (machine friendly, since the primary consumer is an automated agent); --pretty emits indented JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Emit

func Emit(w io.Writer, v any, pretty bool) error

Emit writes v as JSON to w. When pretty is true the output is indented.

Types

type Names added in v0.4.0

type Names struct {
	Users    map[string]string
	Channels map[string]string
}

Names maps user IDs to usernames and channel IDs to readable labels.

type RenderedFile added in v0.6.0

type RenderedFile struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Mime string `json:"mime,omitempty"`
	Size int64  `json:"size"`
}

RenderedFile is an attachment as emitted with a post.

type RenderedPost

type RenderedPost struct {
	ID        string         `json:"id"`
	Time      string         `json:"time"`
	User      string         `json:"user"`
	ChannelID string         `json:"channel_id"`
	Channel   string         `json:"channel,omitempty"`
	RootID    string         `json:"root_id,omitempty"`
	Message   string         `json:"message"`
	Files     []RenderedFile `json:"files,omitempty"`
}

RenderedPost is the flattened, enriched shape we emit for posts: human time and resolved username/channel instead of raw epoch/IDs.

func One

func One(p *mm.Post, names Names) RenderedPost

One renders a single post.

func Posts

func Posts(pl *mm.PostList, names Names) []RenderedPost

Posts flattens a PostList into chronological RenderedPosts (oldest first), resolving IDs via names. Mattermost's PostList.Order is not reliably time-sorted (notably the thread endpoint), so we sort by CreateAt explicitly.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL