pathchmod

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FriendlyChmod = friendlyChmod{}
)

Functions

func ApplyChmod added in v0.1.2

func ApplyChmod(
	isRecursive bool,
	isSkipOnInvalid bool,
	changeFileMode os.FileMode,
	location string,
) (*chmodhelper.RwxWrapper, *errorwrapper.Wrapper)

func ApplyChmodDefault added in v0.7.5

func ApplyChmodDefault(
	changeFileMode os.FileMode,
	location string,
) *errorwrapper.Wrapper

func ApplyChmodOnFiles added in v0.1.2

func ApplyChmodOnFiles(
	isRecursive,
	isSkipOnInvalid,
	isContinueOnError bool,
	changeFileMode os.FileMode,
	locations ...string,
) (*chmodins.RwxInstruction, *errorwrapper.Wrapper)

func ApplyChmodOnFilesUsingCondition added in v0.1.2

func ApplyChmodOnFilesUsingCondition(
	condition *chmodins.Condition,
	changeFileMode os.FileMode,
	locations ...string,
) (*chmodins.RwxInstruction, *errorwrapper.Wrapper)

func ApplyChmodOptions added in v0.7.5

func ApplyChmodOptions(
	isApply,
	isSkipInvalid bool,
	changeFileMode os.FileMode,
	location string,
) *errorwrapper.Wrapper

func ApplyChmodRwxInstructions added in v0.1.2

func ApplyChmodRwxInstructions(
	instructions *chmodins.BaseRwxInstructions,
	paths []string,
) *errorwrapper.Wrapper

func ApplyChmodRwxOwnerGroupOther added in v0.1.5

func ApplyChmodRwxOwnerGroupOther(
	isRecursive,
	isSkipOnInvalid,
	isContinueOnError bool,
	rwxOwnerGroupOther *chmodins.RwxOwnerGroupOther,
	paths []string,
) *errorwrapper.Wrapper

func ApplyChmodSkipInvalidFile added in v0.7.5

func ApplyChmodSkipInvalidFile(
	changeFileMode os.FileMode,
	location string,
) *errorwrapper.Wrapper

func ApplyLinuxRecursiveChmodOnPathUsingFileMode added in v0.1.5

func ApplyLinuxRecursiveChmodOnPathUsingFileMode(
	mode os.FileMode,
	rootDir string,
) *errorwrapper.Wrapper

func ApplyOnMismatch added in v0.7.5

func ApplyOnMismatch(
	isSkipOnInvalid bool,
	changeFileMode os.FileMode,
	location string,
) *errorwrapper.Wrapper

func ApplyOnMismatchOptions added in v0.7.5

func ApplyOnMismatchOptions(
	isApply,
	isSkipOnInvalid bool,
	changeFileMode os.FileMode,
	location string,
) *errorwrapper.Wrapper

func ApplyOnMismatchSkipOnInvalid added in v0.7.5

func ApplyOnMismatchSkipOnInvalid(
	changeFileMode os.FileMode,
	location string,
) *errorwrapper.Wrapper

func ApplyOnOptions added in v0.7.5

func ApplyOnOptions(
	isApply,
	isSkipOnInvalid,
	isApplyOnMismatch bool,
	changeFileMode os.FileMode,
	location string,
) *errorwrapper.Wrapper

func ChangeOwnership

func ChangeOwnership(location, user, group string) *errorwrapper.Wrapper

func ChangeOwnershipLocations added in v0.2.1

func ChangeOwnershipLocations(
	isContinueOnError,
	isRecursive bool,
	user, group string,
	errorCollection *errwrappers.Collection,
	locations []string,
) *errorwrapper.Wrapper

ChangeOwnershipLocations not implemented

TODO : https://gitlab.com/evatix-go/pathhelper/-/issues/56

func ChangeOwnershipOptions added in v0.2.1

func ChangeOwnershipOptions(
	isRecursive bool,
	location, user, group string,
) *errorwrapper.Wrapper

func ChangeOwnershipRecursive added in v0.2.1

func ChangeOwnershipRecursive(location, user, group string) *errorwrapper.Wrapper

func ChangeOwnershipWindows added in v0.2.1

func ChangeOwnershipWindows(location, user, group string) *errorwrapper.Wrapper

ChangeOwnershipWindows non-recursive

func ChangeOwnershipWindowsUsingIds added in v0.2.1

func ChangeOwnershipWindowsUsingIds(
	location string,
	userId, groupId int,
) *errorwrapper.Wrapper

ChangeOwnershipWindowsUsingIds non recursive

func ChmodChangeExecuteRevert added in v0.1.2

func ChmodChangeExecuteRevert(
	isRecursive,
	isSkipOnInvalid bool,
	changeFileMode os.FileMode,
	location string,
	executor func(location string) *errorwrapper.Wrapper,
) *errorwrapper.Wrapper

func ChmodChangeExecuteRevertUsingRwxWrapper added in v0.1.2

func ChmodChangeExecuteRevertUsingRwxWrapper(
	isRecursive,
	isSkipOnInvalid bool,
	changeFileModeRwxWrapper *chmodhelper.RwxWrapper,
	location string,
	executor func(location string) *errorwrapper.Wrapper,
) *errorwrapper.Wrapper

func ChmodLinuxCmdApply added in v0.4.4

func ChmodLinuxCmdApply(
	isRecursive bool,
	isSkipOnError bool,
	rwxWrapper *chmodhelper.RwxWrapper,
	paths ...string,
) *errwrappers.Collection

ChmodLinuxCmdApply

Format : chmod -R 777 /var/lib/powerdns

func ExistingChmodRwxWrapper added in v0.1.2

func ExistingChmodRwxWrapper(
	location string,
) (*chmodhelper.RwxWrapper, *errorwrapper.Wrapper)

func FullRwxToFileMode added in v0.1.5

func FullRwxToFileMode(rwxFull string) (os.FileMode, *errorwrapper.Wrapper)

func FullRwxToRwxWrapper added in v0.1.5

func FullRwxToRwxWrapper(rwxFull string) (*chmodhelper.RwxWrapper, *errorwrapper.Wrapper)

func GetLocationsRwxWrappers added in v0.1.3

func GetLocationsRwxWrappers(
	isContinueOnError bool,
	locations []string,
) (
	filePathToRwxWrapper map[string]*chmodhelper.RwxWrapper,
	errWrap *errorwrapper.Wrapper,
)

func GetUserGroupId added in v0.2.1

func GetUserGroupId(userName string, groupName string) (
	userId int,
	groupId int,
	errWrapper *errorwrapper.Wrapper,
)

func ParseRwxOwnerGroupOtherToFileMode added in v0.1.5

func ParseRwxOwnerGroupOtherToFileMode(
	rwxOwnerGroupOther *chmodins.RwxOwnerGroupOther,
) (os.FileMode, *errorwrapper.Wrapper)

func ParseRwxOwnerGroupOtherToRwxWrapper added in v0.1.5

func ParseRwxOwnerGroupOtherToRwxWrapper(
	rwxOwnerGroupOther *chmodins.RwxOwnerGroupOther,
) (*chmodhelper.RwxWrapper, *errorwrapper.Wrapper)

func VerifyRwxErrorLocations added in v0.1.3

func VerifyRwxErrorLocations(
	isRecursiveErrorIgnore bool,
	instruction *chmodins.RwxInstruction,
	locations []string,
) *errorwrapper.Wrapper

Types

type ChmodWithError added in v0.2.2

type ChmodWithError struct {
	Chmod os.FileMode
	errorwrapper.ErrWrapper
}

func ExistingChmodWithError added in v0.2.2

func ExistingChmodWithError(location string) *ChmodWithError

type RwxWrapperWithError added in v0.2.2

type RwxWrapperWithError struct {
	RwxWrapper *chmodhelper.RwxWrapper
	errorwrapper.ErrWrapper
}

func ExistingRwxWrapperWithError added in v0.2.2

func ExistingRwxWrapperWithError(location string) *RwxWrapperWithError

type SimpleStat added in v0.2.2

type SimpleStat struct {
	Location        string
	FileInfo        os.FileInfo
	Name            string // name with extension
	HasFileInfo     bool
	InvalidFileInfo bool
	IsNotExist      bool
	IsExist         bool
	IsDir           bool
	IsFile          bool
	ErrorWrapper    *errorwrapper.Wrapper
}

func GetSimpleStat added in v0.2.2

func GetSimpleStat(
	location string,
) *SimpleStat

func (*SimpleStat) BothExtension added in v0.4.4

func (it *SimpleStat) BothExtension() (dotExt, ext string)

func (*SimpleStat) CheckSum added in v0.2.2

func (it *SimpleStat) CheckSum(hashType hashas.Variant) *errbyte.Results

func (*SimpleStat) DotExtension added in v0.4.4

func (it *SimpleStat) DotExtension() (fileName, dotExt string)

func (*SimpleStat) FileName added in v0.4.4

func (it *SimpleStat) FileName() string

FileName Returns file name with extension

func (*SimpleStat) FileNameExt added in v0.4.4

func (it *SimpleStat) FileNameExt() string

func (*SimpleStat) FileNameWithoutExt added in v0.4.4

func (it *SimpleStat) FileNameWithoutExt() string

func (*SimpleStat) GetChmodWithError added in v0.2.2

func (it *SimpleStat) GetChmodWithError() *ChmodWithError

func (*SimpleStat) GetRwxWithError added in v0.2.2

func (it *SimpleStat) GetRwxWithError() *RwxWrapperWithError

func (*SimpleStat) HasError added in v0.4.2

func (it *SimpleStat) HasError() bool

func (*SimpleStat) HexCheckSumString added in v0.4.2

func (it *SimpleStat) HexCheckSumString(hashType hashas.Variant) *errstr.Result

func (*SimpleStat) IsEmptyError added in v0.4.2

func (it *SimpleStat) IsEmptyError() bool

func (*SimpleStat) LastModifiedAt added in v0.4.4

func (it *SimpleStat) LastModifiedAt() *time.Time

func (*SimpleStat) ReadBytes added in v0.2.2

func (it *SimpleStat) ReadBytes() *errbyte.Results

func (*SimpleStat) ReadBytesMust added in v0.3.6

func (it *SimpleStat) ReadBytesMust() []byte

func (*SimpleStat) ReadString added in v0.2.2

func (it *SimpleStat) ReadString() *errstr.Result

func (*SimpleStat) ReadStringMust added in v0.3.6

func (it *SimpleStat) ReadStringMust() string

func (*SimpleStat) Size added in v0.4.2

func (it *SimpleStat) Size() *int64

type SimpleStatMap added in v0.2.2

type SimpleStatMap struct {
	Items map[string]*SimpleStat
}

func GetSimpleStats added in v0.2.2

func GetSimpleStats(
	locations []string,
) *SimpleStatMap

func NewSimpleStatMap added in v0.2.2

func NewSimpleStatMap(capacity int) *SimpleStatMap

func (*SimpleStatMap) Add added in v0.2.2

func (it *SimpleStatMap) Add(loc string) *SimpleStatMap

func (*SimpleStatMap) Adds added in v0.2.2

func (it *SimpleStatMap) Adds(locations ...string) *SimpleStatMap

func (*SimpleStatMap) AsBasicMapper added in v0.2.2

func (it *SimpleStatMap) AsBasicMapper() coreinterface.BasicMapper

func (*SimpleStatMap) Count added in v0.2.2

func (it *SimpleStatMap) Count() int

func (*SimpleStatMap) HasAnyItem added in v0.2.2

func (it *SimpleStatMap) HasAnyItem() bool

func (*SimpleStatMap) HasIndex added in v0.2.2

func (it *SimpleStatMap) HasIndex(index int) bool

func (*SimpleStatMap) HasLocation added in v0.2.2

func (it *SimpleStatMap) HasLocation(loc string) bool

func (*SimpleStatMap) IsEmpty added in v0.2.2

func (it *SimpleStatMap) IsEmpty() bool

func (*SimpleStatMap) LastIndex added in v0.2.2

func (it *SimpleStatMap) LastIndex() int

func (*SimpleStatMap) Length added in v0.2.2

func (it *SimpleStatMap) Length() int

func (*SimpleStatMap) Locations added in v0.2.2

func (it *SimpleStatMap) Locations() []string

func (*SimpleStatMap) Names added in v0.3.6

func (it *SimpleStatMap) Names() []string

func (*SimpleStatMap) SimpleStats added in v0.2.2

func (it *SimpleStatMap) SimpleStats() []*SimpleStat

func (SimpleStatMap) String added in v0.2.2

func (it SimpleStatMap) String() string

type SimpleStats added in v0.3.6

type SimpleStats struct {
	Items []*SimpleStat
}

func NewSimpleStats added in v0.3.6

func NewSimpleStats(capacity int) *SimpleStats

func NewSimpleStatsUsingItems added in v0.3.6

func NewSimpleStatsUsingItems(locations ...string) *SimpleStats

func (*SimpleStats) Add added in v0.3.6

func (it *SimpleStats) Add(loc string) *SimpleStats

func (*SimpleStats) Adds added in v0.3.6

func (it *SimpleStats) Adds(locations ...string) *SimpleStats

func (*SimpleStats) AsBasicMapper added in v0.3.6

func (it *SimpleStats) AsBasicMapper() coreinterface.BasicMapper

func (*SimpleStats) Count added in v0.3.6

func (it *SimpleStats) Count() int

func (*SimpleStats) HasAnyItem added in v0.3.6

func (it *SimpleStats) HasAnyItem() bool

func (*SimpleStats) HasIndex added in v0.3.6

func (it *SimpleStats) HasIndex(index int) bool

func (*SimpleStats) HasLocation added in v0.3.6

func (it *SimpleStats) HasLocation(loc string) bool

func (*SimpleStats) IsEmpty added in v0.3.6

func (it *SimpleStats) IsEmpty() bool

func (*SimpleStats) LastIndex added in v0.3.6

func (it *SimpleStats) LastIndex() int

func (*SimpleStats) Length added in v0.3.6

func (it *SimpleStats) Length() int

func (*SimpleStats) Locations added in v0.3.6

func (it *SimpleStats) Locations() []string

func (*SimpleStats) Names added in v0.3.6

func (it *SimpleStats) Names() []string

func (*SimpleStats) SimpleStats added in v0.3.6

func (it *SimpleStats) SimpleStats() []*SimpleStat

func (SimpleStats) String added in v0.3.6

func (it SimpleStats) String() string

type Wrapper added in v0.6.4

type Wrapper struct {
	DirChmod, FileChmod os.FileMode
	IsRecursive         bool
	IsSkipOnInvalid     bool
	IsContinueOnError   bool
	IsKeepExistingChmod bool
}

func DefaultWrapper added in v0.6.4

func DefaultWrapper() Wrapper

func DefaultWrapperRecursive added in v0.6.4

func DefaultWrapperRecursive() Wrapper

func NewWrapper added in v0.6.4

func NewWrapper(
	isKeepExistingChmod bool,
	condition chmodins.Condition,
	dirChmod,
	fileChmod os.FileMode,
) Wrapper

func NewWrapperDir added in v0.7.8

func NewWrapperDir(changeDirMode os.FileMode) Wrapper

func NewWrapperDirFile added in v0.7.8

func NewWrapperDirFile(
	dirChmod,
	fileChmod os.FileMode,
) Wrapper

func NewWrapperFile added in v0.7.5

func NewWrapperFile(changeFileMode os.FileMode) Wrapper

func (*Wrapper) ApplyDirs added in v0.6.4

func (it *Wrapper) ApplyDirs(
	dirPaths ...string,
) (
	rwxInstruction *chmodins.RwxInstruction,
	errWrap *errorwrapper.Wrapper,
)

func (*Wrapper) ApplyFileOptions added in v0.7.5

func (it *Wrapper) ApplyFileOptions(
	isApply,
	isApplyOnMismatch bool,
	changeFileMode os.FileMode,
	location string,
) (errWrap *errorwrapper.Wrapper)

func (*Wrapper) ApplyFiles added in v0.6.4

func (it *Wrapper) ApplyFiles(
	filePaths ...string,
) (
	rwxInstruction *chmodins.RwxInstruction,
	errWrap *errorwrapper.Wrapper,
)

func (Wrapper) AsJsonContractsBinder added in v0.6.4

func (it Wrapper) AsJsonContractsBinder() corejson.JsonContractsBinder

func (*Wrapper) Condition added in v0.6.4

func (it *Wrapper) Condition() *chmodins.Condition

func (*Wrapper) DirChmodDisplay added in v0.7.0

func (it *Wrapper) DirChmodDisplay() string

func (*Wrapper) FileChmodDisplay added in v0.7.0

func (it *Wrapper) FileChmodDisplay() string

func (*Wrapper) FriendlyChmodOfDirFiles added in v0.7.8

func (it *Wrapper) FriendlyChmodOfDirFiles(
	location string,
) string

func (*Wrapper) FriendlyChmodOfPath added in v0.7.8

func (it *Wrapper) FriendlyChmodOfPath(
	location string,
) string

func (*Wrapper) Json added in v0.6.4

func (it *Wrapper) Json() corejson.Result

func (*Wrapper) JsonParseSelfInject added in v0.6.4

func (it *Wrapper) JsonParseSelfInject(jsonResult *corejson.Result) error

func (*Wrapper) JsonPtr added in v0.6.4

func (it *Wrapper) JsonPtr() *corejson.Result

func (*Wrapper) LogFriendlyChmodOfDirFiles added in v0.7.8

func (it *Wrapper) LogFriendlyChmodOfDirFiles(
	location string,
)

func (*Wrapper) LogFriendlyChmodOfPath added in v0.7.8

func (it *Wrapper) LogFriendlyChmodOfPath(
	location string,
)

func (*Wrapper) MarshalJSON added in v0.6.4

func (it *Wrapper) MarshalJSON() (jsonBytes []byte, parsedErr error)

func (*Wrapper) OnInvalidDirMode added in v0.7.8

func (it *Wrapper) OnInvalidDirMode(
	dirChmod os.FileMode,
) *Wrapper

func (*Wrapper) OnInvalidFileMode added in v0.7.8

func (it *Wrapper) OnInvalidFileMode(
	fileChmod os.FileMode,
) *Wrapper

func (*Wrapper) References added in v0.7.0

func (it *Wrapper) References() []ref.Value

func (*Wrapper) SimpleFileRw added in v0.6.4

func (it *Wrapper) SimpleFileRw(
	filePath string,
) *chmodhelper.SimpleFileReaderWriter

func (*Wrapper) SimpleFileRwUsingParent added in v0.6.4

func (it *Wrapper) SimpleFileRwUsingParent(
	absParentDir,
	absFilePath string,
) *chmodhelper.SimpleFileReaderWriter

func (*Wrapper) ToNonPtr added in v0.7.5

func (it *Wrapper) ToNonPtr() Wrapper

func (Wrapper) ToPtr added in v0.7.5

func (it Wrapper) ToPtr() *Wrapper

func (*Wrapper) UnmarshalJSON added in v0.6.4

func (it *Wrapper) UnmarshalJSON(rawJsonBytes []byte) error

Jump to

Keyboard shortcuts

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