refactor util functions
Signed-off-by: Nathan13888 <29968201+Nathan13888@users.noreply.github.com>
This commit is contained in:
parent
b4cfcd0696
commit
6cdd9ddf97
|
@ -0,0 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func GetAbsPath(path string) string {
|
||||
absPath, err := filepath.Abs(path)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("Failed to get absolute path.")
|
||||
return path
|
||||
}
|
||||
return absPath
|
||||
}
|
||||
|
||||
func NormalizeName(name string) string {
|
||||
trimmed := strings.Trim(name, " ")
|
||||
return strings.ToLower(trimmed)
|
||||
}
|
Loading…
Reference in New Issue