Documentation ¶
Index ¶
- Variables
- func AskDangerous(question string, def bool) bool
- func AskPassword(name string) string
- func CreateFile(path string, conflictPolicy FileConflictPolicy) (*os.File, error)
- func DecryptBase64Str(in, password string) (string, error)
- func DecryptFromFile(path, password string, writer io.Writer) error
- func EncryptToBase64Str(in, password string) (string, error)
- func EncryptToFile(reader io.Reader, path, password string) error
- func ExistsAsDir(path string) (yes bool)
- func ExistsAsFile(path string) (yes bool)
- func FormattedJSON(o interface{}) (string, error)
- func Glob(path string, filter func(string) bool) ([]string, error)
- func LoadJson(reader io.Reader, out interface{}) error
- func LoadJsonFile(path string, out interface{}) error
- func MustGetUserHome() string
- func PrintJSON(o interface{})
- func SplitPath(path string) (dirPath, fileBaseName, ext string)
- func Walk(path *WalkOptions) error
- func WriteJSON(writer io.Writer, o interface{}) error
- func WriteJSONFile(path string, conflictPolicy FileConflictPolicy, data interface{}) error
- type FileConflictPolicy
- type FileCrytor
- type UserInputReader
- func (uir *UserInputReader) BoolOr(question string, def bool) bool
- func (uir *UserInputReader) Float(name string) float64
- func (uir *UserInputReader) FloatOr(name string, def float64) float64
- func (uir *UserInputReader) Int(name string) int
- func (uir *UserInputReader) IntOr(name string, def int) int
- func (uir *UserInputReader) Secret(msg string) string
- func (uir *UserInputReader) Select(name string, options []string, def string) string
- func (uir *UserInputReader) String(name string) string
- func (uir *UserInputReader) StringOr(name string, def string) string
- type WalkOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrKey = errors.New("failed generate key") ErrCipher = errors.New("failed to create cipher") ErrFile = errors.New("failed read/write file") ErrInput = errors.New("invalid input") )
View Source
var ( ErrTooManyIndexedFiles = errors.New("io.indexedFile.exceededLimit") ErrUnknownConflictPolicy = errors.New("io.fileCreate.unknownConflictPolicy") )
Functions ¶
func AskDangerous ¶
func AskPassword ¶
AskPassword - asks password, prints the given name before asking
func CreateFile ¶
func CreateFile( path string, conflictPolicy FileConflictPolicy) (*os.File, error)
func DecryptBase64Str ¶
func EncryptToBase64Str ¶
func ExistsAsDir ¶
ExistsAsDir - checks if a directory exists at given path. If a error occurs while stating whatever exists at given location, false is returned
func ExistsAsFile ¶
ExistsAsFile - checks if a regular file exists at given path. If a error occurs while stating whatever exists at given location, false is returned
func FormattedJSON ¶
FormattedJSON - converts given data to JSON and returns as pretty printed
func LoadJsonFile ¶
func MustGetUserHome ¶
func MustGetUserHome() string
func PrintJSON ¶
func PrintJSON(o interface{})
PrintJSON - dumps JSON representation of given data to stdout
func Walk ¶
func Walk(path *WalkOptions) error
func WriteJSONFile ¶
func WriteJSONFile( path string, conflictPolicy FileConflictPolicy, data interface{}) error
Types ¶
type FileConflictPolicy ¶
type FileConflictPolicy int
const ( Append FileConflictPolicy = iota Overwrite RenameOriginalWithIndex RenameOriginalWithTimestamp NameNewWithIndex NameNewWithTimestamp )
type FileCrytor ¶
type FileCrytor interface { Encrypt(in []byte) ([]byte, error) Decrypt(in []byte) ([]byte, error) IsEncrypted(in []byte) bool }
func NewCryptor ¶
func NewCryptor(password string) FileCrytor
type UserInputReader ¶
type UserInputReader struct {
// contains filtered or unexported fields
}
func NewUserInputReader ¶
func NewUserInputReader(input io.Reader, output io.Writer) *UserInputReader
func StdUserInputReader ¶
func StdUserInputReader() *UserInputReader
func (*UserInputReader) Float ¶
func (uir *UserInputReader) Float(name string) float64
func (*UserInputReader) FloatOr ¶
func (uir *UserInputReader) FloatOr(name string, def float64) float64
func (*UserInputReader) Int ¶
func (uir *UserInputReader) Int(name string) int
func (*UserInputReader) Secret ¶
func (uir *UserInputReader) Secret(msg string) string
Secret - asks password from user, does not echo charectors
func (*UserInputReader) Select ¶
func (uir *UserInputReader) Select( name string, options []string, def string) string
func (*UserInputReader) String ¶
func (uir *UserInputReader) String(name string) string
type WalkOptions ¶
type WalkOptions struct { }
Click to show internal directories.
Click to hide internal directories.