feat: centralize history storage in config directory

Automatically migrates existing ~/.ssh/sshm_history.json to platform-appropriate config location
This commit is contained in:
2025-09-11 17:10:39 +02:00
parent aa6be1d92d
commit 8c6f3b01ef
3 changed files with 132 additions and 4 deletions

View File

@@ -40,8 +40,8 @@ func GetDefaultSSHConfigPath() (string, error) {
}
}
// GetSSHMBackupDir returns the SSHM backup directory
func GetSSHMBackupDir() (string, error) {
// GetSSHMConfigDir returns the SSHM config directory
func GetSSHMConfigDir() (string, error) {
homeDir, err := os.UserHomeDir()
if err != nil {
return "", err
@@ -67,6 +67,15 @@ func GetSSHMBackupDir() (string, error) {
}
}
return configDir, nil
}
// GetSSHMBackupDir returns the SSHM backup directory
func GetSSHMBackupDir() (string, error) {
configDir, err := GetSSHMConfigDir()
if err != nil {
return "", err
}
return filepath.Join(configDir, "backups"), nil
}