homedir

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package homedir provides functionality to expand `~` to the absolute home directory of a user and vice-versa.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collapse

func Collapse(path string) string

Collapse replaces the homedir in absolute paths with `~`.

E.g. `/home/user/foo` will be rewritten to `~/foo`. Relative paths are returned as is. If GOOS is windows this func does nothing. Panics if discovery of the home directory fails.

func Expand

func Expand(path string) string

expand expands the path to include the home directory if the path is prefixed with `~`. If it isn't prefixed with `~`, the path is returned as-is. Panics if discovery of the home directory fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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