-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimport_configurations_from_host.py
More file actions
48 lines (35 loc) · 1.17 KB
/
import_configurations_from_host.py
File metadata and controls
48 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import os
from pathlib import Path
def import_bash_conf():
with open(os.path.join(Path.home(), ".bashrc")) as data:
user_bash_conf = data.read()
return user_bash_conf
def import_zsh_conf():
with open(os.path.join(Path.home(), ".zshrc")) as data:
user_zsh_conf = data.read()
return user_zsh_conf
def import_nvim_conf():
with open(os.path.join(Path.home(), ".config/nvim/init.lua")) as data:
user_nvim_conf = data.read()
return user_nvim_conf
def main(config_type: str = "bash"):
"""
Main function that returns values from other functions based on parameters.
Args:
config_type: Type of configuration to import ("bash", "zsh", "nvim")
Returns:
String containing the imported configuration content
"""
config_type = config_type.lower()
if config_type == "bash":
return import_bash_conf()
elif config_type == "zsh":
return import_zsh_conf()
elif config_type == "nvim":
return import_nvim_conf()
else:
raise ValueError(
f"Unknown configuration type: {config_type}. Use 'bash', 'zsh', or 'nvim'"
)
if __name__ == "__main__":
main()