junix

package module
v0.0.0-...-3b750ba Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2016 License: MIT Imports: 4 Imported by: 0

README

junix

A re-implementation of common Unix commands with output as JSON instead of plain text

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileInfoColumns = Result{
	Columns: []Column{
		{"name", "base name of the file"},
		{"size", "length in bytes for regular files; system-dependent for others"},
		{"size_humanized", "human friendly representation of the filesize"},
		{"mode", "file mode bits as a string"},
		{"mode_int", "file mode bits as a number"},
		{"mod_time", "modification time"},
		{"is_dir", "true if path is a directory"},
	},
}

FileInfoColumns are columns for use by file info utilities

Functions

func Die

func Die(enc *json.Encoder, err error)

Types

type Column

type Column struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

Column describes one data attribute

type FileInfo

type FileInfo struct {
	// base name of the file
	Name string `json:"name"`
	// length in bytes for regular files; system-dependent for others
	Size int `json:"size"`
	// human friendly representation of the filesize
	SizeHumanized string `json:"size_humanized"`
	// file mode bits as a string
	Mode string `json:"mode"`
	// file mode bits as a number
	ModeInt int `json:"mode_int"`
	// modification time
	ModTime time.Time `json:"mod_time"`
	// abbreviation for Mode().IsDir()
	IsDir bool `json:"is_dir"`
}

FileInfo is a struct for (un)marshalling os.FileInfo

func NewFileInfo

func NewFileInfo(fi os.FileInfo) FileInfo

type Result

type Result struct {
	Columns []Column    `json:"columns"`
	Errors  []string    `json:"errors"`
	Meta    interface{} `json:"meta"`
}

Result is the type for the first blob returned by a Junix tool. It describes the subsequent items.

Directories

Path Synopsis
cmd
jcol
jcol takes a stream of junix json blobs and pretty prints them as columns
jcol takes a stream of junix json blobs and pretty prints them as columns
jls

Jump to

Keyboard shortcuts

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