Documentation ¶
Index ¶
- Constants
- Variables
- func Alert(l Level, msg string)
- func Delete(path string) error
- func FileExists(path string) bool
- func IsDir(path string) bool
- func IsIgnorable(s string, ignore []string) bool
- func IsPathUpdated(old, current models.Settings, t string) bool
- func IsSettingsUpdated(old, current models.Settings) bool
- func IsType(typ string, isDir bool) bool
- func ListDir(root, currentPath, typ string, ignore []string, level int) ([]string, [][]string, error)
- func NewFolder(name string) error
- func NormalizePath(path string) string
- func NotyaPWD(settings models.Settings) (*string, error)
- func OpenViaEditor(filepath string, stdargs models.StdArgs, settings models.Settings) error
- func OutputLevel(l Level) string
- func Print(data string, c color.Attribute)
- func PrintErrors(act string, errs []error)
- func PrintNodes(list []models.Node)
- func PrintNote(note models.Note)
- func PrintServices(c string, services []string)
- func PrintSettings(settings models.Settings)
- func ReadBody(path string) (*string, error)
- func Spinner() *spinner.Spinner
- func WriteNote(path, body string) error
- type Level
Constants ¶
const ( GREY string = "\033[1;30m" RED string = "\033[0;31m" GREEN string = "\033[0;32m" YELLOW string = "\033[1;33m" DARKYELLOW string = "\033[2;33m" PURPLE string = "\033[1;35m" CYAN string = "\033[1;36m" NOCOLOR string = "\033[0m" )
Defined constant color codes, for OutputLevel.
const ( ERROR string = "[X]" SUCCESS string = "[✔]" INFO string = "[I]" )
Defined constant icon/title codes.
const Version = "v0.1.5"
Version is current version of application.
Variables ¶
var (
// Color and Icon of logger's "CURRENT" output message.
Icon, Color string
// ColorableStd is main stdargs of logger. [colorable stdargs].
ColorableStd = models.StdArgs{
Stdout: colorable.NewColorableStdout(),
Stderr: colorable.NewColorableStderr(),
}
)
var ( // Custom configuration for survey icons and colors. // See [https://github.com/mgutz/ansi#style-format] for details. SurveyIconsConfig = func(icons *survey.IconSet) { icons.Question.Format = "cyan" icons.Question.Text = "[?]" icons.Help.Format = "blue" icons.Help.Text = "Help ->" icons.Error.Format = "yellow" icons.Error.Text = "Warning ->" } )
Functions ¶
func Alert ¶
Alert, logs message at given Level.
l - (Level) decides style(Level) of log message. msg - (message) is the content of log message.
func FileExists ¶
FileExists, checks if any type of file exists at given path.
func IsIgnorable ¶
IsIgnorable is a boolean to check if provided [s] value is in [ignore] list or not.
func IsPathUpdated ¶
IsPathUpdated checks notes' differences of [old] and [current] settings. Appropriate to base service-type. Provided from [t].
Note: This function moved from models/settings.go, because go doesn't allow to do import cycle.
func IsSettingsUpdated ¶
IsSettingsUpdated compares [old] and [current] Settings models. If any field of [old] is different that [current], result eventually gonna be [true].
Note: This function moved from models/settings.go, because go doesn't allow to do import cycle.
func ListDir ¶
func ListDir(root, currentPath, typ string, ignore []string, level int) ([]string, [][]string, error)
ListDir, reads all files from given-path directory. and returns: 1. a slice of exact names of files and folders + subfiles and subfolders. 2. nested hierarchy of first array
func NormalizePath ¶
NormalizePath normalizes given path and returns a normalized path.
func NotyaPWD ¶
NotyaPWD, generates path of notya's notes directory. ╭───────────────────────╮ ╭────────╮ ╭────────────╮ │ ~/user-home-directory │ + │ /notya │ = │ local path │ ╰───────────────────────╯ ╰────────╯ ╰────────────╯
func OpenViaEditor ¶
OpenViaEditor opens file in custom(appropriate from settings) from given path.
func OutputLevel ¶
OutputLevel sets Color and Icon by given Level, and then, returns final printable Level title.
Result cases: ERROR - (powered with red color) [OK] - (powered with green color) INFO - (powered with yellow color)
func PrintErrors ¶
PrintErrors, is general error logger for push and fetch command error results.
func PrintServices ¶
PrintServices logs given service names by provided color level.
func PrintSettings ¶
PrintSettings, logs given settings model.