pathprefix

package
v2.19.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package pathprefix is used to print correct filepaths for a configured workspace.

The default workspace is the current working directory. Users may override the default workspace using the --workspace flag.

The functions defined here should be used when printing any filepath to the user, as they might otherwise be incorrect if the user has changed the workspace.

The prefixer MUST not be used when accessing files, as the workspace is changed using os.Chdir() before the command is executed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathPrefixer

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

PathPrefixer is used to prefix paths with the configured workspace for printing.

func New

func New(workspace string) PathPrefixer

New returns a new PathPrefixer.

func (PathPrefixer) PrefixPrintablePath added in v2.10.1

func (p PathPrefixer) PrefixPrintablePath(path string) string

PrefixPrintablePath prefixes the given path with the configured workspace for printing. This function MUST not be used when accessing files. This function SHOULD be used when printing paths to the user.

Jump to

Keyboard shortcuts

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