mirror of
https://github.com/Gu1llaum-3/sshm.git
synced 2026-03-14 03:41:27 +01:00
feat: add info command for JSON host details
Adds a jq-friendly `sshm info` subcommand with host completion and documentation, and makes home directory resolution testable for backup path tests.
This commit is contained in:
@@ -456,15 +456,21 @@ func TestBackupConfigToSSHMDirectory(t *testing.T) {
|
||||
// Create temporary directory for test files
|
||||
tempDir := t.TempDir()
|
||||
|
||||
// Override the home directory for this test
|
||||
originalHome := os.Getenv("HOME")
|
||||
if originalHome == "" {
|
||||
originalHome = os.Getenv("USERPROFILE") // Windows
|
||||
originalHome = os.Getenv("USERPROFILE")
|
||||
}
|
||||
originalXDG := os.Getenv("XDG_CONFIG_HOME")
|
||||
originalAppData := os.Getenv("APPDATA")
|
||||
|
||||
// Set test home directory
|
||||
os.Setenv("HOME", tempDir)
|
||||
defer os.Setenv("HOME", originalHome)
|
||||
os.Setenv("XDG_CONFIG_HOME", tempDir)
|
||||
os.Setenv("APPDATA", tempDir)
|
||||
defer func() {
|
||||
os.Setenv("HOME", originalHome)
|
||||
os.Setenv("XDG_CONFIG_HOME", originalXDG)
|
||||
os.Setenv("APPDATA", originalAppData)
|
||||
}()
|
||||
|
||||
// Create a test SSH config file
|
||||
sshDir := filepath.Join(tempDir, ".ssh")
|
||||
|
||||
Reference in New Issue
Block a user