display

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 7 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 display 渲染 CLI 的终端文本:实体列表行、详情卡片、身份格式与上游文本转义。

本包只供 internal/cli 使用;JSON 与 NDJSON 由 internal/record 输出,不经过这里。 只服务一个命令的渲染留在该命令目录。

包的组成:SafeLine 把上游文本转成可安全打印的单行, Identity 输出 `用户名 (UID)`,作品、小说与用户的列表行和详情卡片在同一包内。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identity

func Identity(username string, userID int64) string

Identity 把用户名与 UID 写成 `用户名 (UID)`;用户名为空时只写 UID。

func PrintArtworkDetail

func PrintArtworkDetail(out io.Writer, item pixiv.Artwork) error

PrintArtworkDetail 输出作品详情卡片;上游文本转义为单行。

func PrintArtworks

func PrintArtworks(out io.Writer, items []pixiv.Artwork) error

PrintArtworks 每项输出一行标题、作者和收藏数,并转义上游文本。

func PrintArtworksRanked

func PrintArtworksRanked(out io.Writer, items []pixiv.Artwork, offset int) error

PrintArtworksRanked 在每项前加排名;offset 是本批在整体结果中的起点。

func PrintNovelContent

func PrintNovelContent(out io.Writer, content pixiv.NovelContent) error

PrintNovelContent 输出结构化小说正文。

func PrintNovelDetail

func PrintNovelDetail(out io.Writer, item pixiv.Novel) error

PrintNovelDetail 输出小说详情卡片,并转义上游文本。

func PrintNovels

func PrintNovels(out io.Writer, items []pixiv.Novel) error

PrintNovels 转义小说标题和作者,每本小说输出一行。

func PrintUserDetail

func PrintUserDetail(out io.Writer, result pixiv.UserDetail) error

PrintUserDetail 只展示人可读且有值的文本字段;固定计数保留零值,以免把公开的 “没有作品/关注”误报为字段缺失。完整机器可读字段由 --json 原样输出 SDK DTO。

func PrintUserPreviews

func PrintUserPreviews(out io.Writer, users []pixiv.UserPreview) error

PrintUserPreviews 转义用户名,每个用户预览输出一行。

func SafeLine

func SafeLine(value string) string

SafeLine 转义换行、ANSI ESC 与其他控制字节,保留可打印 Unicode。逐行终端输出依赖 它防止上游文本破坏一条记录一行的协议;JSON 输出由 encoding/json 自行转义,不经过 这里。

Types

This section is empty.

Jump to

Keyboard shortcuts

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