suddendeath

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

README

go-suddendeath ("突然の死" generator in Go)

go-suddendeath generates "突然の死" like message based on the given string.

_人人人人人人_
> 突然の死 <
 ̄Y^Y^Y^Y^Y ̄

Usage

suddendeath package is the package to import for your own projects.

See sample files in _example directory for how to use.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HeaderRunes = []rune{'人'}
	FooterRunes = []rune{'Y'}
	LeftChar    = ">"
	RightChar   = "<"
)

Functions

func Body

func Body(msg string) string

Body returns the message body part of "突然の死" like message. Body adds side ornament characters and spaces in each lines.

func Footer(msg string) string

Footer returns the footer string of "突然の死" like message based on the display width of msg.

func Format

func Format(msg string) string

Format returns "突然の死"-nized version of msg.

func Header(msg string) string

Header returns the header string of "突然の死" like message based on the display width of msg.

func MessageWidth

func MessageWidth(msg string) int

MessageWidth is the display width of assined string msg. msg is expected to be single line; i.e. not including \r and \n. It is based on the information from Unicode. So-called Multibyte characters' width is counted as 2. Other characters' are 1. See https://godoc.org/golang.org/x/text/width for the details.

func Print

func Print(msg string)

Print simply prints the string using fmt.Println.

func RuneWidth added in v0.2.0

func RuneWidth(r rune) int

RuneWidth returns the display width of r.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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