Skip to content

Commit 55a73a7

Browse files
committed
fixing shell identifier function
1 parent 1375035 commit 55a73a7

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "sshkey-switch"
7-
version = "0.2.0"
7+
version = "0.4.0"
88
description = "A command-line tool for switching SSH keys"
99
readme = "README.md"
1010
authors = [

sshkey_switch/main.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import sys
1212
import re
1313
import shutil
14+
import platform
1415
import subprocess
1516
from pathlib import Path
1617
from collections import OrderedDict
@@ -28,16 +29,9 @@
2829
ACTIVATION_MESSAGE = False
2930
EXCLUDE_FILES = {"authorized_keys", "known_hosts"}
3031

31-
def get_os_shell_profile() -> Path | None:
32-
"""Returns the appropriate shell profile file path based on the user's current shell."""
33-
shell = os.getenv("SHELL", "").split('/')[-1].lower()
34-
35-
shell_profiles = {
36-
"bash": BASHRC_FILE,
37-
"zsh": ZSHRC_FILE
38-
}
39-
40-
return shell_profiles.get(shell, None) # Return None for unsupported shells
32+
def get_os_shell_profile():
33+
"""Return the correct shell profile file based on OS."""
34+
return ZSHRC_FILE if platform.system() == "Darwin" else BASHRC_FILE
4135

4236
def check_ssh_environment():
4337
"""Check if /root/.ssh directory and ssh-agent binary exist."""

0 commit comments

Comments
 (0)