summaryrefslogtreecommitdiff
path: root/formatENV.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-27 00:26:10 -0500
committerJeff Carr <[email protected]>2025-10-27 00:26:10 -0500
commitdbe78b785508d8ef665d8b9c4d61e4dd8eb40e51 (patch)
treee25ef3eb97a435318f6e52a3709e3625ed20561c /formatENV.go
parent4d0828def125f96d376cc1bd018bd3d8b0997901 (diff)
add some more details. not much more to do here.
Diffstat (limited to 'formatENV.go')
-rw-r--r--formatENV.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/formatENV.go b/formatENV.go
index ea2931c..6a2ab79 100644
--- a/formatENV.go
+++ b/formatENV.go
@@ -3,6 +3,7 @@ package env
import (
"errors"
"fmt"
+ "path/filepath"
"strings"
)
@@ -39,6 +40,11 @@ func formatENV() (string, error) {
// don't write out anything defined globally
continue
}
+ // turns "/home/user/" into ~/
+ relpath, err := filepath.Rel(envPB.HomeDir, c.Value)
+ if err == nil {
+ c.Value = filepath.Join("~", relpath)
+ }
line := fmt.Sprintf("%s=%s", c.Var, c.Value)
out += line + "\n"
}