output

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(message string, force bool) (bool, error)

Confirm 사용자에게 확인 프롬프트를 표시하고 결과를 반환

force=true: 즉시 true 반환 non-tty: 즉시 false 반환 + stderr에 "--force 필요" 메시지 tty: stdin에서 Y/n 입력 대기

func FormatNumberPublic

func FormatNumberPublic(f float64) string

FormatNumberPublic 숫자를 사람이 읽기 좋은 문자열로 변환 (외부 패키지용)

func FormatPercent

func FormatPercent(rate float64) string

FormatPercent 변화율을 +/-부호 포함 퍼센트로 포맷

func IsTTY

func IsTTY() bool

IsTTY 현재 stdout이 tty인지 확인

func ToMapSlice

func ToMapSlice(data interface{}) []map[string]interface{}

ToMapSlice 슬라이스를 []map[string]interface{}로 변환 (외부 패키지용)

Types

type CSVFormatter

type CSVFormatter struct {
	// contains filtered or unexported fields
}

CSVFormatter CSV 출력 포맷터

func NewCSVFormatter

func NewCSVFormatter() *CSVFormatter

NewCSVFormatter CSVFormatter 생성

func (*CSVFormatter) Format

func (f *CSVFormatter) Format(data interface{}) error

Format CSV로 출력

type Formatter

type Formatter interface {
	Format(data interface{}) error
}

Formatter 출력 포맷터 인터페이스

func NewFormatter

func NewFormatter(output string, jsonFields string) Formatter

NewFormatter 포맷터 생성 output: "auto" | "table" | "json" | "jsonl" | "csv" jsonFields: 쉼표로 구분된 필드 목록 (비어있으면 전체 출력)

func NewFormatterWithColumns

func NewFormatterWithColumns(output string, jsonFields string, columns []TableColumn) Formatter

NewFormatterWithColumns 컬럼 정의가 포함된 포맷터 생성 columns가 지정되면 테이블 출력 시 해당 컬럼만 표시 (JSON/CSV는 전체 데이터 유지)

type JSONFieldsFormatter

type JSONFieldsFormatter struct {
	// contains filtered or unexported fields
}

JSONFieldsFormatter --json fields 처리 포맷터 지정된 필드만 추출하여 JSON 출력

func NewJSONFieldsFormatter

func NewJSONFieldsFormatter(fields string, pretty bool) *JSONFieldsFormatter

NewJSONFieldsFormatter JSONFieldsFormatter 생성 fields: 쉼표로 구분된 필드 목록

func (*JSONFieldsFormatter) Format

func (f *JSONFieldsFormatter) Format(data interface{}) error

Format 지정 필드만 추출하여 JSON 출력

type JSONFormatter

type JSONFormatter struct {
	// contains filtered or unexported fields
}

JSONFormatter JSON 출력 포맷터 tty: pretty print (indent 2), non-tty: compact (한 줄)

func NewJSONFormatter

func NewJSONFormatter(pretty bool) *JSONFormatter

NewJSONFormatter JSONFormatter 생성

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(data interface{}) error

Format JSON으로 출력

type JSONLFormatter

type JSONLFormatter struct{}

JSONLFormatter JSONL (JSON Lines) 출력 포맷터 슬라이스의 각 항목을 한 줄씩 출력

func NewJSONLFormatter

func NewJSONLFormatter() *JSONLFormatter

NewJSONLFormatter JSONLFormatter 생성

func (*JSONLFormatter) Format

func (f *JSONLFormatter) Format(data interface{}) error

Format JSONL로 출력

type TableColumn

type TableColumn struct {
	Header string // 표시할 헤더 (예: "마켓", "현재가")
	Key    string // JSON 키 (예: "market", "trade_price")
	Format string // "number", "percent", "date", "string" (선택, 기본: 자동)
}

TableColumn 테이블 컬럼 정의

type TableFormatter

type TableFormatter struct {
	// contains filtered or unexported fields
}

TableFormatter 테이블 출력 포맷터

func NewTableFormatter

func NewTableFormatter() *TableFormatter

NewTableFormatter TableFormatter 생성

func NewTableFormatterWithColumns

func NewTableFormatterWithColumns(columns []TableColumn) *TableFormatter

NewTableFormatterWithColumns 컬럼이 지정된 TableFormatter 생성

func (*TableFormatter) Format

func (f *TableFormatter) Format(data interface{}) error

func (*TableFormatter) FormatWithColumns

func (f *TableFormatter) FormatWithColumns(data interface{}, columns []TableColumn) error

FormatWithColumns 지정된 컬럼만 테이블로 출력

Jump to

Keyboard shortcuts

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