symlinkopts

package
v0.0.0-...-f5d8d17 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package symlinkopts provides an efficient interface to create unambiguous symlink options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

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

Options represents a set of options for handling symlinks. The zero value is equivalent to skipping all symlinks.

func PreserveAllowDangling

func PreserveAllowDangling() Options

PreserveAllowDangling returns the correct set of options to preserve all symlinks without targets.

Targets need to be explicitly included. Dangling links are allowed.

func PreserveNoDangling

func PreserveNoDangling() Options

PreserveNoDangling returns the correct set of options to preserve all symlinks without targets.

Targets need to be explicitly included. Dangling links are not allowed.

func PreserveWithTarget

func PreserveWithTarget() Options

PreserveWithTarget returns the correct set of options to preserve all symlinks and include the targets.

This implies that dangling links are not allowed.

func ResolveAlways

func ResolveAlways() Options

ResolveAlways return the correct set of options to always resolve symlinks.

This implies that symlinks are followed and no dangling symlinks are allowed. Every symlink will be replaced by its target. For example, if foo/bar was a symlink to the regular file baz, then foo/bar will become a regular file with the content of baz.

func ResolveExternalOnly

func ResolveExternalOnly() Options

ResolveExternalOnly returns the correct set of options to only resolve symlinks if the target is outside the root directory. Otherwise, the symlink is preserved.

This implies that all symlinks are followed, therefore, no dangling links are allowed. Otherwise, it's not possible to guarantee that all required files are under the root. Targets of non-external symlinks are not included.

func ResolveExternalOnlyWithTarget

func ResolveExternalOnlyWithTarget() Options

ResolveExternalOnlyWithTarget is like ResolveExternalOnly but targets of non-external symlinks are included.

func Skip

func Skip() Options

Skip is the zero value for Options which is equivalent to skipping all symlinks (as if they did not exist).

func (Options) IncludeTarget

func (o Options) IncludeTarget() bool

IncludeTarget returns true if the options include the corresponding property.

func (Options) NoDangling

func (o Options) NoDangling() bool

NoDangling returns true if the options include the corresponding property.

func (Options) Preserve

func (o Options) Preserve() bool

Preserve returns true if the options include the corresponding property.

func (Options) Resolve

func (o Options) Resolve() bool

Resolve returns true if the options include the corresponding property.

func (Options) ResolveExternal

func (o Options) ResolveExternal() bool

ResolveExternal returns true if the options include the corresponding property.

func (Options) Skip

func (o Options) Skip() bool

Skip returns true if the options indicate that symlinks should be skipped.

func (Options) String

func (o Options) String() string

String returns a string representation of the options.

The string has at most five letters:

P for Preserve
N for No Dangling
I for Include Target
R for Replace
E for Replace External

Jump to

Keyboard shortcuts

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