preview

package module
v0.0.0-...-03ff648 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2016 License: MIT Imports: 5 Imported by: 0

README

preview

Command Line Tool for Previewing a File

Install

go get github.com/morikuni/preview/cmd/preview

How to use

$ preview -width 64 lena.png

sample.png

Supported file type

  • png
  • jpg
  • gif
  • tiff
  • bmp
  • txt

Documentation

Index

Constants

View Source
const (
	// Color8 is config to use 8 color.
	Color8 = Color(0)

	// Color256 is config to use 256 color.
	Color256 = Color(1)
)
View Source
const (
	// UnsupportedError is used when a given file is not supported.
	UnsupportedError = previewError("not supported file type.")
)
View Source
const WindowSizeError = previewError("failed to load window size")

WindowSizeError is used when WindowSize() failed.

Variables

This section is empty.

Functions

func Preview

func Preview(path string, out io.Writer, conf *Config) error

Preview print a file to out with conf.

func Register

func Register(tags []string, pf previewFunc)

Register register Renderer constructor.

Types

type Color

type Color int

Color is enum of color set.

type Config

type Config struct {
	Width  uint
	Height uint
	Color  Color
}

Config represents configuration data.

func NewConfig

func NewConfig(args []string) (*Config, []string, error)

NewConfig parse args and create Config.

type Renderer

type Renderer interface {
	Render(io.Writer) error
}

Renderer draw a file to io.Writer.

type WindowSize

type WindowSize struct {
	Height uint16
	Width  uint16
	// contains filtered or unexported fields
}

WindowSize represents window size.

func GetWindowSize

func GetWindowSize() (*WindowSize, error)

GetWindowSize get WindowSize by system call.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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