From b649f6986351bcf477b8f31de50d3837e1c84e7e Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Wed, 14 Jan 2026 23:51:28 -0800 Subject: [PATCH] Improve tilde expansion in export path handling Refines logic to correctly expand both '~/...' and '~' to the user's home directory when specifying export paths. --- cmd/history/export.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/history/export.go b/cmd/history/export.go index 32d206a..a7efb8d 100644 --- a/cmd/history/export.go +++ b/cmd/history/export.go @@ -92,10 +92,15 @@ func ExportCmd() *cobra.Command { } if exportPath != "" { - if exportPath[:1] == "~" { + if len(exportPath) >= 2 && exportPath[:2] == "~/" { home, err := os.UserHomeDir() if err == nil { - exportPath = filepath.Join(home, exportPath[1:]) + exportPath = filepath.Join(home, exportPath[2:]) + } + } else if exportPath == "~" { + home, err := os.UserHomeDir() + if err == nil { + exportPath = home } }