paths

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HomeDir

func HomeDir() (string, error)

HomeDir returns the current user's cleaned home dir path (no trailing '/').

func IsDir

func IsDir(path string) bool

IsDir checks if a path is a directory.

func IsFile

func IsFile(path string) bool

IsFile checks if a path is a regular file

func IsSubpath

func IsSubpath(p, parent string) bool

IsSubpath checks if path `p` is a subpath of `parent`

func ToCheck

func ToCheck(cwd, home string) (paths []string)

ToCheck returns all paths to check using the checkers. Currently only paths under the home directory are returned for security, but this will become configurable in a future version.

Types

type Shorten

type Shorten struct {
	Home    string
	Current string
}

Shorten shortens paths by replacing the home dir with '~' and current dir with '.' for display.

func (Shorten) Do

func (s Shorten) Do(p string) string

Do performs the actual shortening of a path.

Jump to

Keyboard shortcuts

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