os_decorator

package
v0.0.0-...-adf331d Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExitCode

type ExitCode int

ExitCode - application exit code

func (ExitCode) Int

func (c ExitCode) Int() int

Int converts ExitCode to int

type OSDecorator

type OSDecorator interface {
	// GetArgs Argument - returns command line arguments without application name
	GetArgs() []string

	// Create creates or truncates the named file
	Create(path string) (fld.FileDecorator, error)

	// Exit causes the current program to exit with the given error
	Exit(code ExitCode, err error)

	// IsExist checks if path is existence
	IsExist(path string) error

	// MkdirAll creates directory named path
	MkdirAll(path string, perm os.FileMode) error

	// ReadFile loads file
	ReadFile(path string) ([]byte, error)
}

OSDecorator - os methods decorator interface

func Mock

Mock creates mocked os decorator object

func New

func New() OSDecorator

New creates os decorator object

type OSDecoratorMockOpt

type OSDecoratorMockOpt struct {
	FuncGetArgs  func() []string
	FuncCreate   func(path string) (fld.FileDecorator, error)
	FuncExit     func(code ExitCode, err error)
	FuncIsExist  func(path string) error
	FuncMkdirAll func(path string, perm os.FileMode) error
	FuncReadFile func(path string) ([]byte, error)
}

OSDecoratorMockOpt contains mock methods of initialize mocked decorator object

Jump to

Keyboard shortcuts

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