cmpath

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cmpath is a library dedicated specifically to handling paths in a Nomos repository in a type safe way. It is not a generalized path library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Absolute

type Absolute string

Absolute represents an absolute path on a file system. The path is slash-delimited, but can be converted into the os-specific representation.

func AbsoluteOS

func AbsoluteOS(p string) (Absolute, error)

AbsoluteOS returns an Absolute path from an OS-specific path.

Converts p to an absolute path if it is not already. Assumes the current working directory is the path p is relative to.

func AbsoluteSlash

func AbsoluteSlash(p string) (Absolute, error)

AbsoluteSlash returns an Absolute path from a slash-delimited path.

It is an error to pass a non-absolute path.

func (Absolute) Equal

func (p Absolute) Equal(other Absolute) bool

Equal returns true if the underlying absolute paths are equal.

func (p Absolute) EvalSymlinks() (Absolute, error)

EvalSymlinks evaluates any symlinks in the Absolute and returns a new Absolute with no symlinks.

func (Absolute) Join

func (p Absolute) Join(r Relative) Absolute

Join appends r to p, creating a new Absolute path.

func (Absolute) OSPath

func (p Absolute) OSPath() string

OSPath implements id.Path.

func (Absolute) SlashPath

func (p Absolute) SlashPath() string

SlashPath implements id.Path.

func (Absolute) Split

func (p Absolute) Split() []string

Split returns a slice of the path elements.

type Relative

type Relative string

Relative represents a relative path on a file system. The path is slash-delimited, but can be converted into the os-specific representation. The path is not guaranteed to be relative to the current working directory.

func RelativeOS

func RelativeOS(p string) Relative

RelativeOS returns an Relative path from an OS-specific path.

func RelativeSlash

func RelativeSlash(p string) Relative

RelativeSlash returns an Relative path from a slash-delimited path.

func (Relative) Base

func (p Relative) Base() string

Base returns the Base of this Path.

func (Relative) Dir

func (p Relative) Dir() Relative

Dir returns the directory containing this Path.

func (Relative) Equal

func (p Relative) Equal(other Relative) bool

Equal returns true if the underlying relative paths are equal.

func (Relative) IsRoot

func (p Relative) IsRoot() bool

IsRoot returns true if the path is the Nomos root directory.

func (Relative) Join

func (p Relative) Join(r Relative) Relative

Join appends r to p, creating a new Relative path.

func (Relative) OSPath

func (p Relative) OSPath() string

OSPath implements id.Path.

func (Relative) SlashPath

func (p Relative) SlashPath() string

SlashPath implements id.Path.

func (Relative) Split

func (p Relative) Split() []string

Split returns a slice of the path elements.

Jump to

Keyboard shortcuts

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