Documentation
¶
Index ¶
- Constants
- Variables
- func CheckDBFile() error
- func CheckDataDir() error
- func ColorizeBlue(s string) string
- func ColorizeGreen(s string) string
- func ColorizeRed(s string) string
- func ColorizeYellow(s string) string
- func Completer(options []string) func(d prompt.Document) []prompt.Suggest
- func CreateLedgerTables(name string, currency string) error
- func GetBankerDBPath() string
- func GetCurrencyNames() []string
- func GetDateFromUser() time.Time
- func InitializeBanker() error
- func PadLeft(text string, padCount int) string
- func RestoreTermState()
- func SaveTermState()
Constants ¶
const ( ColorDefault = "\x1b[39m" ColorRed = "\x1b[91m" ColorGreen = "\x1b[32m" ColorBlue = "\x1b[94m" ColorYellow = "\x1b[33m" )
Variables ¶
var CurrencySymbols = map[string]string{
"GBP": "£",
"INR": "₹",
"USD": "$",
}
A map of currency names to symbols
var Locales = map[string]string{
"GBP": "en-GB",
"INR": "en-IN",
"USD": "en-US",
}
A map of currencies to locales
Functions ¶
func CheckDBFile ¶
func CheckDBFile() error
CheckDBFile checks if db_filename is present in the viper configuration file and that it exists in the filesystem, otherwise it returns an error
func CheckDataDir ¶
func CheckDataDir() error
CheckDataDir checks if data_directory is present in the viper configuration file and that it exists in the filesystem, otherwise it returns an error
func ColorizeBlue ¶
ColorizeBlue returns a given string that is formatted in blue color
func ColorizeGreen ¶
ColorizeGreen returns a given string that is formatted in green color
func ColorizeRed ¶
ColorizeRed returns a given string that is formatted in red color
func ColorizeYellow ¶
ColorizeYellow returns a given string that is formatted in yellow color
func Completer ¶
func Completer(options []string) func(d prompt.Document) []prompt.Suggest
Completer returns matched suggestions from the list of options as the input is typed
func CreateLedgerTables ¶
CreateLedgerTables creates required tables for a ledger
It adds an entry in the ledgers table It creates the below tables with ledger name prefixed
for example if name = uk
- uk_accounts
- uk_categories
- uk_transactions
- uk_split_transactions
func GetBankerDBPath ¶
func GetBankerDBPath() string
GetBankerDBPath reads viper config and returns the absolute path to the banker sqlite database file as string
func GetCurrencyNames ¶
func GetCurrencyNames() []string
GetCurrencyNames iterates through CurrencySymbols map and returns a slice of strings that contains the currency names
func GetDateFromUser ¶ added in v0.1.1
func InitializeBanker ¶
func InitializeBanker() error
InitializeBanker creates ledgers table in the banker sqlite database
func RestoreTermState ¶
func RestoreTermState()
RestoreTermState restores a previously saved terminal state
func SaveTermState ¶
func SaveTermState()
SaveTermState saves the current terminal state which can then be restored if needed
Types ¶
This section is empty.