modulepackage
0.0.7
Repository: https://github.com/equationzhao/pathbeautify.git
Documentation: pkg.go.dev
# README
path beautify
Usage
package main
import (
"fmt"
"github.com/Equationzhao/pathbeautify"
)
func main() {
fmt.Println(pathbeautify.Beautify("~/Downloads"))
// output: /home/equationzhao/Downloads
fmt.Println(pathbeautify.Beautify("../.../..../.."))
// output: ../../../../../../..
}
# Functions
Beautify is alias of Transform.
CleanSeparator convert '//' and '\' to os-specific separator.
GetUserHomeDir returns user home directory if error, return empty string.
GetUserHomeDirWithErr returns user home directory if error, return the error.
No description provided by the author
Transform path
~ -> $HOME ~/a/b/c -> $HOME/a/b/c ..