pathlist

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pathlist implements functions to manipulate PATH-like environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List interface {
	// Reset resets the list of directories to an empty slice.
	Reset()

	// Contains returns true if the list contains the path.
	Contains(string) bool

	// Nil returns true if the list is emppty.
	Nil() bool

	// Load reads the list of directories from a string.
	Load(string)

	// LoadEnv parses the value of an environment variable. It expects
	// the value to be a string of directories separates by the rune
	// filepath.ListSeparator.
	LoadEnv(string)

	// Prepend the list with a path.
	Prepend(string)

	// Append a path to the list.
	Append(string)

	// Drop remove a path from the list.
	Drop(string)

	// Slice returns the path list as a slice of strings.
	Slice() []string

	// String returns the path list as a string of path list
	// separator-separated directories.
	String() string
}

List builds a list of directories by parsing PATH-like variables and can perform operations on it such as append, prepend, or remove, while keeping the list duplicate-free.

func New

func New() List

New creates a new path list.

Jump to

Keyboard shortcuts

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