render

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package render は論理イベントを各種フォーマットで出力する。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountLabel

func AccountLabel(r model.Resource) string

func CSV

func CSV(w io.Writer, events []model.LogicalEvent) error

CSV はリソース単位の行で出力する(リソースが無いイベントは1行、リソース列は空)。

func Countdown

func Countdown(status string, start, now time.Time) string

Countdown は開始までの残り時間を短く表す。進行中/開始済みは "ongoing"/"started"。

func FormatDate

func FormatDate(t time.Time) string

FormatDate は日付のみ "2006-01-02"(displayLoc)で整形する(ゼロ値は "-")。

func FormatTime

func FormatTime(t time.Time) string

func GroupLabel

func GroupLabel(g model.EventGroup, topicMode bool) string

GroupLabel は表示ラベル(topicMode なら話題ラベル、無ければ eventTypeCode)。

func GroupMarkdown

func GroupMarkdown(w io.Writer, groups []model.EventGroup, now time.Time, topicMode bool)

GroupMarkdown はファミリーのサマリ表を Markdown で出力する。

func GroupTable

func GroupTable(w io.Writer, groups []model.EventGroup, now time.Time, topicMode, showDetails, showResources, showOccurrences bool)

GroupTable はファミリーのサマリ表+(オプションで)説明・リソース・配下日程を出力する。

func JSON

func JSON(w io.Writer, events []model.LogicalEvent) error

JSON は論理イベントを整形 JSON で出力する。

func JoinRegions

func JoinRegions(regions []string) string

func Markdown

func Markdown(w io.Writer, events []model.LogicalEvent, now time.Time, showDetails, showResources bool)

Markdown はテーブルと、変更内容説明・影響リソースのサブセクションを出力する。

func OrDash

func OrDash(s string) string

func Render

func Render(w io.Writer, format string, events []model.LogicalEvent, now time.Time, showDetails, showResources bool) error

Render は指定フォーマットで論理イベントを出力する。

func RenderGroups

func RenderGroups(w io.Writer, format string, groups []model.EventGroup, now time.Time, topicMode, showDetails, showResources, showOccurrences bool) error

RenderGroups は eventTypeCode/topic 単位のロールアップを出力する。 topicMode が true のとき TOPIC 列(話題ラベル)を表示する。

func SanitizeCell added in v0.5.0

func SanitizeCell(s string) string

SanitizeCell は 1 行セル向け。ANSI を除去し、改行・タブ・CR を含むすべての制御文字を 空白化してテーブル/CSV のレイアウト崩れと端末インジェクションを防ぐ。

func SanitizeText added in v0.5.0

func SanitizeText(s string) string

SanitizeText は複数行ブロック向け。改行・タブは保持しつつ ANSI と他の制御文字を除去する。

func SetDisplayLocation

func SetDisplayLocation(loc *time.Location)

SetDisplayLocation は時刻表示のタイムゾーンを設定する(CLI 起動時に一度だけ呼ぶ想定)。

func StatusSummary

func StatusSummary(counts map[string]int) string

StatusSummary は status 件数を深刻度順に "open:2 upcoming:5" のように整形する。

func Table

func Table(w io.Writer, events []model.LogicalEvent, now time.Time, showDetails, showResources bool)

Table はマージ済みイベントを tabwriter のテーブルで出力する。 IN 列は開始までの残り時間(now 基準)。showDetails で変更内容説明、 showResources で影響リソースを各イベントの下に展開する。

func ZoneAbbrev

func ZoneAbbrev(t time.Time) string

ZoneAbbrev は t を表示タイムゾーンに変換したときのゾーン略称("UTC"/"JST" 等)を返す。

func ZoneName

func ZoneName() string

ZoneName は現在の表示タイムゾーン名("UTC"/"Local"/"Asia/Tokyo" 等)。

Types

This section is empty.

Jump to

Keyboard shortcuts

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