utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AmendArt string = BoldWhite.Sprint(`
                     _
 ___ _____ ___ ___ _| |
| .'|     | -_|   | . |
|__,|_|_|_|___|_|_|___|
`)
View Source
var BoldBlue = color.New(color.FgBlue).Add(color.Bold)
View Source
var BoldGreen = color.New(color.FgGreen).Add(color.Bold)
View Source
var BoldRed = color.New(color.FgRed).Add((color.Bold))
View Source
var BoldWhite = color.New(color.FgWhite).Add(color.Bold)
View Source
var BoldYellow = color.New(color.FgYellow).Add(color.Bold)
View Source
var CurrentDate string = time.Now().Format("01-02-2006")
View Source
var CurrentMonth string = time.Now().Format("January")
View Source
var CurrentYear string = time.Now().Format("2006")
View Source
var DeleteArt string = BoldWhite.Sprint(`
   _     _     _
 _| |___| |___| |_ ___
| . | -_| | -_|  _| -_|
|___|___|_|___|_| |___|
`)
View Source
var ErrorArt string = BoldRed.Sprint(`
 ___ 
| -_|
|___|
`)
View Source
var InArt string = BoldWhite.Sprint(`
 _
|_|___ 
| |   |
|_|_|_|
`)
View Source
var ListArt string = BoldWhite.Sprint(`
 _ _     _
| |_|___| |_
| | |_ -|  _|
|_|_|___|_|
`)
View Source
var OutArt string = BoldWhite.Sprint(`
         _ 
 ___ _ _| |_
| . | | |  _|
|___|___|_|
`)
View Source
var StatusArt string = BoldWhite.Sprint(`
     _       _
 ___| |_ ___| |_ _ _ ___ 
|_ -|  _| .'|  _| | |_ -|
|___|_| |__,|_| |___|___|
`)
View Source
var StorageArt string = BoldWhite.Sprint(`
     _
 ___| |_ ___ ___ ___ ___ ___ 
|_ -|  _| . |  _| .'| . | -_|
|___|_| |___|_| |__,|_  |___|
                    |___|
`)
View Source
var VersionArt string = BoldWhite.Sprint(`
     _   _ ___ _ 
 ___| |_|_|  _| |_
|_ -|   | |  _|  _|
|___|_|_|_|_| |_|   v1.0.0
`)

Functions

func CRUD

func CRUD(timesheetFn func(), databaseFn func())

Main CRUD switch execute the timesheet or database function depending on the `storage-type` value set in `.shiftconfig.yml`.

func CheckError

func CheckError(message string, err error)

Check if there is an error. Panic if an error is not `nil`.

func CheckSelection

func CheckSelection(rowNums []int) int

Check if the selection pointing to a target shift is valid.

func ConfirmInput

func ConfirmInput(action string) string

Loop to confirm "Y/N" options.

func FormatFlags

func FormatFlags(cmd *cobra.Command) (string, string, string)

Get the `dayOrDate`, `month`, and `year` parameters from flag input.

func GetCWD

func GetCWD() string

Get the current working directory.

func GetTimesheetByDFlags

func GetTimesheetByDFlags(month string, modify bool, year string) (*os.File, error)

Get the timesheet based on the values set by date-related flags.

func NoMatchesError

func NoMatchesError(dayOrDate string, month string, year string)

Format and then display the error message if no matches were found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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