Documentation ¶
Index ¶
- func ByteCountSI(b int64) string
- func Dedent(s string) string
- func Exists(path string) (bool, error)
- func FileSize(filename string) int64
- func FileSizeToString(filename string) string
- func GenerateRandomKey(n int) string
- func GetFileExtension(filename string) string
- func Indent(s string, indent int) string
- func IsDirectory(path string) (bool, error)
- func IsEmpty(path string) bool
- func IsHidden(path string, forceHidden bool) bool
- func LPad(s string, padding int) string
- func MergeStructs(structs ...interface{}) reflect.Type
- func Prompt(prompt *InteractivePrompt) bool
- func RPad(s string, padding int) string
- type Directory
- type File
- type InteractivePrompt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteCountSI ¶
ByteCountSI - converts bytes to {bytes, KB, MB, GB}
@param {int64} b - the number of bytes @return {string} - the converted bytes
func Dedent ¶
Dedent - trims spaces on the left side of a line
@param {string} s - string to dedent @return {string}
func Exists ¶
Exists - checks if a directory exists
@param {string} path - the path to the directory @return {bool} - true if the directory exists @return {error} - error
func FileSize ¶
FileSize - gets the file size
@param {string} filename - the filename @return {int64} - the file size
func FileSizeToString ¶
FileSizeToString - gets the file size and converts it to {bytes, KB, MB, GB}
@param {string} filename - the filename @return {string} - the file size
func GenerateRandomKey ¶
GenerateRandomKey - generates a random key for the hill cipher
@param n - the size of the key @return key - the key
func GetFileExtension ¶
GetFileExtension - gets the file extension
@param {string} filename - the filename @return {string} - the file extension
func Indent ¶
Indent - indents the string
@param s - the string to indent @param indent - the number of spaces to indent @return string - the indented string
func IsDirectory ¶
IsDirectory returns true if the path is a directory.
@param path - the path to the file/directory. @return bool - true if the path is a directory.
func IsEmpty ¶
IsEmpty returns true if the directory is empty
@param path - the path to the directory @return bool - true if the directory is empty
func IsHidden ¶
IsHidden returns true if the file/directory is hidden
@param path - the path to the file/directory @param forceHidden - true if the file/directory is forced to be hidden @return bool - true if the file/directory is hidden
func LPad ¶
LPad - adds padding to the left of a command
@param {string} s - string to be worked on @param {int} padding - number of padding @return string
func MergeStructs ¶
MergeStructs - merge multiple structs into one struct
@param {interface{}} structs - structs to be merged @return interface{}
func Prompt ¶
func Prompt(prompt *InteractivePrompt) bool
Prompt - prompt the user for confirmation.
@param {string} prompt - the prompt to display to the user. @param {string} color - the color of the prompt. @param {string} confirmation - the confirmation string. @return {bool} - true if the user confirmed the prompt.
Types ¶
type Directory ¶
type Directory struct { Name string `json:"name"` Path string `json:"path"` IsEmpty bool `json:"is_empty"` Files []*File `json:"files"` Directories []*Directory `json:"directories"` }
Directory - a directory structure
func WalkDirectory ¶
WalkDirectory - repeatedly steps through a directory and returns the
@param {string} root - the path to the directory @return {*Directory} - the directory info @return {error} - error
type File ¶
type File struct { Name string `json:"name"` Path string `json:"path"` Info fs.FileInfo `json:"info"` }
File - a file structure
type InteractivePrompt ¶
type InteractivePrompt struct { Prompt string Type string // warning, error, info, success, danger, default Confirmation bool }
InteractivePrompt - the prompt to display to the user.