op

package
v0.0.0-...-8c29073 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package op implement dotfiles operations and reporting

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustPrintln

func MustPrintln(res Result)

MustPrintln is like Println but panics in case of error

func Println

func Println(res Result) (n int, err error)

Println formats op.Result as string and writes it to standard output with newline appended

func Sprint

func Sprint(res Result) string

Sprint formats op.Result as string

Types

type LinkResult

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

LinkResult represent symlink's link operation result

func (*LinkResult) SourcePath

func (res *LinkResult) SourcePath() string

SourcePath returns symlink's source path

func (*LinkResult) SourceState

func (res *LinkResult) SourceState() *State

SourceState returns symlink's source state

func (*LinkResult) TargetPath

func (res *LinkResult) TargetPath() string

TargetPath returns symlink's target path

func (*LinkResult) TargetState

func (res *LinkResult) TargetState() *State

TargetState returns symlink's target state

type ReadResult

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

ReadResult represent symlink's read operation result

func (*ReadResult) SourcePath

func (res *ReadResult) SourcePath() string

SourcePath returns symlink's source path

func (*ReadResult) SourceState

func (res *ReadResult) SourceState() *State

SourceState returns symlink's source state

func (*ReadResult) TargetPath

func (res *ReadResult) TargetPath() string

TargetPath returns symlink's target path

func (*ReadResult) TargetState

func (res *ReadResult) TargetState() *State

TargetState returns symlink's target state

type Result

type Result interface {
	TargetPath() string
	TargetState() *State
	SourcePath() string
	SourceState() *State
}

Result represent symlink's operation result

func Link(s *symlink.Symlink) Result

Link runs link op and return result

func Read

func Read(s *symlink.Symlink) Result

Read runs read op and return result

func Unlink(s *symlink.Symlink) Result

Unlink runs link op and return result

type State

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

State represents possible target or source state

func NewCompleteState

func NewCompleteState(l string) *State

NewCompleteState returns State of `stateComplete`

func NewErrorState

func NewErrorState(l string) *State

NewErrorState returns State of `stateError`

func NewIncompleteState

func NewIncompleteState(l string) *State

NewIncompleteState returns State of `stateIncomplete`

func NewUnknownState

func NewUnknownState(l string) *State

NewUnknownState returns State of `stateUnknown`

func (*State) IsComplete

func (st *State) IsComplete() bool

IsComplete checks whether state is `stateComplete`

func (*State) IsError

func (st *State) IsError() bool

IsError checks whether state is `stateError`

func (*State) String

func (st *State) String() string

type UnlinkResult

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

UnlinkResult represent symlink's unlink operation result

func (*UnlinkResult) SourcePath

func (res *UnlinkResult) SourcePath() string

SourcePath returns symlink's source path

func (*UnlinkResult) SourceState

func (res *UnlinkResult) SourceState() *State

SourceState returns symlink's source state

func (*UnlinkResult) TargetPath

func (res *UnlinkResult) TargetPath() string

TargetPath returns symlink's target path

func (*UnlinkResult) TargetState

func (res *UnlinkResult) TargetState() *State

TargetState returns symlink's target state

Jump to

Keyboard shortcuts

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