path

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 4 Imported by: 4

Documentation

Overview

package path provides a simple wrapper around a string path that can expand the users home directory, a common CLI need. Might be extracted into its own library and removed from warg if I find myself needing it in other code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Path

type Path struct {
	// contains filtered or unexported fields
}

func New

func New(path string) Path

func (Path) Expand

func (p Path) Expand() (string, error)

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.

func (Path) MustExpand

func (p Path) MustExpand() string

MustExpand calls `Expand` and panics on any errors

func (Path) String

func (p Path) String() string

Jump to

Keyboard shortcuts

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