doc: add and improve comments

This commit is contained in:
Sebastian Mark 2024-10-30 11:03:18 +01:00
parent 6187122b81
commit f19ab81dc8
11 changed files with 31 additions and 8 deletions

View file

@ -10,6 +10,7 @@ import (
ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
)
// Expands the `~` in a passed filename
func expandUnixPath(filename string) string {
if strings.HasPrefix(filename, "~/") {
dirname, _ := os.UserHomeDir()
@ -19,12 +20,14 @@ func expandUnixPath(filename string) string {
return filename
}
// Checks if the passed file exists
func FileExists(filename string) bool {
_, err := os.Stat(expandUnixPath(filename))
return !os.IsNotExist(err)
}
// Parses the ChronoTomato config in the passed config file
func ParseConfig(filename string) ChronoTomato.Config {
var config ChronoTomato.Config