machineconfig 2.0__py3-none-any.whl → 2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of machineconfig might be problematic. Click here for more details.

Files changed (253) hide show
  1. machineconfig/cluster/cloud_manager.py +0 -3
  2. machineconfig/cluster/data_transfer.py +0 -1
  3. machineconfig/cluster/file_manager.py +0 -1
  4. machineconfig/cluster/job_params.py +0 -3
  5. machineconfig/cluster/loader_runner.py +0 -3
  6. machineconfig/cluster/remote_machine.py +0 -1
  7. machineconfig/cluster/script_notify_upon_completion.py +0 -1
  8. machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +5 -6
  9. machineconfig/cluster/sessions_managers/archive/session_managers.py +0 -1
  10. machineconfig/cluster/sessions_managers/enhanced_command_runner.py +17 -57
  11. machineconfig/cluster/sessions_managers/wt_local.py +36 -110
  12. machineconfig/cluster/sessions_managers/wt_local_manager.py +42 -112
  13. machineconfig/cluster/sessions_managers/wt_remote.py +23 -30
  14. machineconfig/cluster/sessions_managers/wt_remote_manager.py +20 -62
  15. machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +10 -15
  16. machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +27 -127
  17. machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +10 -43
  18. machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +22 -101
  19. machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +11 -39
  20. machineconfig/cluster/sessions_managers/zellij_local.py +49 -102
  21. machineconfig/cluster/sessions_managers/zellij_local_manager.py +34 -78
  22. machineconfig/cluster/sessions_managers/zellij_remote.py +17 -24
  23. machineconfig/cluster/sessions_managers/zellij_remote_manager.py +7 -13
  24. machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +4 -2
  25. machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +6 -6
  26. machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +18 -88
  27. machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +2 -6
  28. machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +12 -40
  29. machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +3 -2
  30. machineconfig/cluster/templates/cli_click.py +0 -1
  31. machineconfig/cluster/templates/cli_gooey.py +0 -2
  32. machineconfig/cluster/templates/cli_trogon.py +0 -1
  33. machineconfig/cluster/templates/run_cloud.py +0 -1
  34. machineconfig/cluster/templates/run_cluster.py +0 -1
  35. machineconfig/cluster/templates/run_remote.py +0 -1
  36. machineconfig/cluster/templates/utils.py +27 -46
  37. machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
  38. machineconfig/jobs/linux/msc/cli_agents.sh +16 -0
  39. machineconfig/jobs/python/check_installations.py +2 -1
  40. machineconfig/jobs/python/create_bootable_media.py +0 -2
  41. machineconfig/jobs/python/python_ve_symlink.py +9 -11
  42. machineconfig/jobs/python/tasks.py +0 -1
  43. machineconfig/jobs/python/vscode/api.py +5 -5
  44. machineconfig/jobs/python/vscode/link_ve.py +13 -14
  45. machineconfig/jobs/python/vscode/select_interpreter.py +21 -22
  46. machineconfig/jobs/python/vscode/sync_code.py +9 -13
  47. machineconfig/jobs/python_custom_installers/archive/ngrok.py +13 -13
  48. machineconfig/jobs/python_custom_installers/dev/aider.py +7 -15
  49. machineconfig/jobs/python_custom_installers/dev/alacritty.py +9 -18
  50. machineconfig/jobs/python_custom_installers/dev/brave.py +10 -19
  51. machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +8 -15
  52. machineconfig/jobs/python_custom_installers/dev/code.py +12 -32
  53. machineconfig/jobs/python_custom_installers/dev/cursor.py +3 -14
  54. machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +8 -7
  55. machineconfig/jobs/python_custom_installers/dev/espanso.py +15 -19
  56. machineconfig/jobs/python_custom_installers/dev/goes.py +5 -12
  57. machineconfig/jobs/python_custom_installers/dev/lvim.py +9 -17
  58. machineconfig/jobs/python_custom_installers/dev/nerdfont.py +12 -19
  59. machineconfig/jobs/python_custom_installers/dev/redis.py +12 -20
  60. machineconfig/jobs/python_custom_installers/dev/wezterm.py +12 -19
  61. machineconfig/jobs/python_custom_installers/dev/winget.py +5 -23
  62. machineconfig/jobs/python_custom_installers/docker.py +12 -21
  63. machineconfig/jobs/python_custom_installers/gh.py +11 -19
  64. machineconfig/jobs/python_custom_installers/hx.py +32 -16
  65. machineconfig/jobs/python_custom_installers/warp-cli.py +12 -20
  66. machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  67. machineconfig/jobs/python_generic_installers/config.json +1 -1
  68. machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  69. machineconfig/jobs/windows/archive/archive_pygraphviz.ps1 +1 -1
  70. machineconfig/jobs/windows/msc/cli_agents.bat +0 -0
  71. machineconfig/jobs/windows/msc/cli_agents.ps1 +0 -0
  72. machineconfig/jobs/windows/start_terminal.ps1 +1 -1
  73. machineconfig/profile/create.py +38 -26
  74. machineconfig/profile/create_hardlinks.py +29 -20
  75. machineconfig/profile/shell.py +56 -32
  76. machineconfig/scripts/__init__.py +0 -2
  77. machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
  78. machineconfig/scripts/cloud/init.sh +2 -2
  79. machineconfig/scripts/linux/checkout_versions +1 -1
  80. machineconfig/scripts/linux/choose_wezterm_theme +1 -1
  81. machineconfig/scripts/linux/cloud_copy +1 -1
  82. machineconfig/scripts/linux/cloud_manager +1 -1
  83. machineconfig/scripts/linux/cloud_mount +1 -1
  84. machineconfig/scripts/linux/cloud_repo_sync +1 -1
  85. machineconfig/scripts/linux/cloud_sync +1 -1
  86. machineconfig/scripts/linux/croshell +1 -1
  87. machineconfig/scripts/linux/devops +7 -7
  88. machineconfig/scripts/linux/fire +1 -1
  89. machineconfig/scripts/linux/fire_agents +3 -2
  90. machineconfig/scripts/linux/ftpx +1 -1
  91. machineconfig/scripts/linux/gh_models +1 -1
  92. machineconfig/scripts/linux/kill_process +1 -1
  93. machineconfig/scripts/linux/mcinit +1 -1
  94. machineconfig/scripts/linux/repos +1 -1
  95. machineconfig/scripts/linux/scheduler +1 -1
  96. machineconfig/scripts/linux/start_slidev +1 -1
  97. machineconfig/scripts/linux/start_terminals +1 -1
  98. machineconfig/scripts/linux/url2md +1 -1
  99. machineconfig/scripts/linux/warp-cli.sh +122 -0
  100. machineconfig/scripts/linux/wifi_conn +1 -1
  101. machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
  102. machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
  103. machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
  104. machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
  105. machineconfig/scripts/python/__pycache__/fire_agents.cpython-313.pyc +0 -0
  106. machineconfig/scripts/python/ai/__init__.py +0 -0
  107. machineconfig/scripts/python/ai/generate_files.py +83 -0
  108. machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +2 -2
  109. machineconfig/scripts/python/ai/mcinit.py +14 -7
  110. machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +10 -5
  111. machineconfig/scripts/python/archive/tmate_conn.py +5 -5
  112. machineconfig/scripts/python/archive/tmate_start.py +7 -7
  113. machineconfig/scripts/python/choose_wezterm_theme.py +35 -32
  114. machineconfig/scripts/python/cloud_copy.py +23 -14
  115. machineconfig/scripts/python/cloud_mount.py +36 -24
  116. machineconfig/scripts/python/cloud_repo_sync.py +40 -27
  117. machineconfig/scripts/python/cloud_sync.py +4 -4
  118. machineconfig/scripts/python/croshell.py +40 -29
  119. machineconfig/scripts/python/devops.py +45 -27
  120. machineconfig/scripts/python/devops_add_identity.py +15 -25
  121. machineconfig/scripts/python/devops_add_ssh_key.py +8 -8
  122. machineconfig/scripts/python/devops_backup_retrieve.py +18 -16
  123. machineconfig/scripts/python/devops_devapps_install.py +25 -20
  124. machineconfig/scripts/python/devops_update_repos.py +232 -59
  125. machineconfig/scripts/python/dotfile.py +17 -15
  126. machineconfig/scripts/python/fire_agents.py +48 -22
  127. machineconfig/scripts/python/fire_jobs.py +93 -58
  128. machineconfig/scripts/python/ftpx.py +26 -15
  129. machineconfig/scripts/python/get_zellij_cmd.py +8 -7
  130. machineconfig/scripts/python/helpers/cloud_helpers.py +33 -28
  131. machineconfig/scripts/python/helpers/helpers2.py +27 -16
  132. machineconfig/scripts/python/helpers/helpers4.py +45 -32
  133. machineconfig/scripts/python/helpers/helpers5.py +1 -1
  134. machineconfig/scripts/python/helpers/repo_sync_helpers.py +32 -10
  135. machineconfig/scripts/python/mount_nfs.py +9 -16
  136. machineconfig/scripts/python/mount_nw_drive.py +10 -5
  137. machineconfig/scripts/python/mount_ssh.py +9 -7
  138. machineconfig/scripts/python/repos.py +216 -58
  139. machineconfig/scripts/python/snapshot.py +0 -1
  140. machineconfig/scripts/python/start_slidev.py +11 -6
  141. machineconfig/scripts/python/start_terminals.py +22 -16
  142. machineconfig/scripts/python/viewer_template.py +0 -1
  143. machineconfig/scripts/python/wifi_conn.py +49 -75
  144. machineconfig/scripts/python/wsl_windows_transfer.py +9 -7
  145. machineconfig/scripts/windows/checkout_version.ps1 +1 -3
  146. machineconfig/scripts/windows/choose_wezterm_theme.ps1 +1 -3
  147. machineconfig/scripts/windows/cloud_copy.ps1 +2 -6
  148. machineconfig/scripts/windows/cloud_manager.ps1 +1 -1
  149. machineconfig/scripts/windows/cloud_repo_sync.ps1 +1 -2
  150. machineconfig/scripts/windows/cloud_sync.ps1 +2 -2
  151. machineconfig/scripts/windows/croshell.ps1 +2 -2
  152. machineconfig/scripts/windows/devops.ps1 +1 -4
  153. machineconfig/scripts/windows/dotfile.ps1 +1 -3
  154. machineconfig/scripts/windows/fire.ps1 +1 -1
  155. machineconfig/scripts/windows/ftpx.ps1 +2 -2
  156. machineconfig/scripts/windows/gpt.ps1 +1 -1
  157. machineconfig/scripts/windows/kill_process.ps1 +1 -2
  158. machineconfig/scripts/windows/mcinit.ps1 +1 -1
  159. machineconfig/scripts/windows/mount_nfs.ps1 +1 -1
  160. machineconfig/scripts/windows/mount_ssh.ps1 +1 -1
  161. machineconfig/scripts/windows/pomodoro.ps1 +1 -1
  162. machineconfig/scripts/windows/py2exe.ps1 +1 -3
  163. machineconfig/scripts/windows/repos.ps1 +1 -1
  164. machineconfig/scripts/windows/scheduler.ps1 +1 -1
  165. machineconfig/scripts/windows/snapshot.ps1 +2 -2
  166. machineconfig/scripts/windows/start_slidev.ps1 +1 -1
  167. machineconfig/scripts/windows/start_terminals.ps1 +1 -1
  168. machineconfig/scripts/windows/wifi_conn.ps1 +1 -1
  169. machineconfig/scripts/windows/wsl_windows_transfer.ps1 +1 -3
  170. machineconfig/settings/lf/linux/lfrc +2 -1
  171. machineconfig/settings/linters/.ruff_cache/.gitignore +2 -0
  172. machineconfig/settings/linters/.ruff_cache/CACHEDIR.TAG +1 -0
  173. machineconfig/settings/lvim/windows/archive/config_additional.lua +1 -1
  174. machineconfig/settings/svim/linux/init.toml +1 -1
  175. machineconfig/settings/svim/windows/init.toml +1 -1
  176. machineconfig/setup_linux/web_shortcuts/croshell.sh +3 -52
  177. machineconfig/setup_linux/web_shortcuts/interactive.sh +6 -6
  178. machineconfig/setup_linux/web_shortcuts/ssh.sh +0 -4
  179. machineconfig/setup_windows/web_shortcuts/all.ps1 +2 -2
  180. machineconfig/setup_windows/web_shortcuts/ascii_art.ps1 +1 -1
  181. machineconfig/setup_windows/web_shortcuts/croshell.ps1 +1 -1
  182. machineconfig/setup_windows/web_shortcuts/interactive.ps1 +5 -5
  183. machineconfig/setup_windows/wt_and_pwsh/install_fonts.ps1 +51 -15
  184. machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +58 -13
  185. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +45 -37
  186. machineconfig/utils/ai/generate_file_checklist.py +8 -10
  187. machineconfig/utils/ai/url2md.py +4 -2
  188. machineconfig/utils/cloud/onedrive/setup_oauth.py +1 -0
  189. machineconfig/utils/cloud/onedrive/transaction.py +63 -98
  190. machineconfig/utils/code.py +62 -41
  191. machineconfig/utils/installer.py +29 -35
  192. machineconfig/utils/installer_utils/installer_abc.py +11 -11
  193. machineconfig/utils/installer_utils/installer_class.py +155 -74
  194. machineconfig/utils/links.py +112 -31
  195. machineconfig/utils/notifications.py +211 -0
  196. machineconfig/utils/options.py +41 -42
  197. machineconfig/utils/path.py +13 -6
  198. machineconfig/utils/path_reduced.py +614 -311
  199. machineconfig/utils/procs.py +48 -42
  200. machineconfig/utils/scheduling.py +0 -1
  201. machineconfig/utils/source_of_truth.py +27 -0
  202. machineconfig/utils/ssh.py +146 -85
  203. machineconfig/utils/terminal.py +84 -37
  204. machineconfig/utils/upgrade_packages.py +91 -0
  205. machineconfig/utils/utils2.py +39 -50
  206. machineconfig/utils/utils5.py +195 -116
  207. machineconfig/utils/ve.py +13 -5
  208. {machineconfig-2.0.dist-info → machineconfig-2.2.dist-info}/METADATA +14 -13
  209. {machineconfig-2.0.dist-info → machineconfig-2.2.dist-info}/RECORD +212 -237
  210. machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
  211. machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
  212. machineconfig/jobs/python/__pycache__/python_ve_symlink.cpython-311.pyc +0 -0
  213. machineconfig/jobs/python/archive/python_tools.txt +0 -12
  214. machineconfig/jobs/python/vscode/__pycache__/select_interpreter.cpython-311.pyc +0 -0
  215. machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  216. machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  217. machineconfig/jobs/python_generic_installers/update.py +0 -3
  218. machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  219. machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
  220. machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
  221. machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
  222. machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
  223. machineconfig/scripts/linux/activate_ve +0 -87
  224. machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
  225. machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
  226. machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
  227. machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
  228. machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
  229. machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
  230. machineconfig/scripts/python/__pycache__/devops_backup_retrieve.cpython-311.pyc +0 -0
  231. machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
  232. machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
  233. machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
  234. machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
  235. machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
  236. machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
  237. machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
  238. machineconfig/scripts/python/ai/__pycache__/init.cpython-311.pyc +0 -0
  239. machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-311.pyc +0 -0
  240. machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
  241. machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
  242. machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
  243. machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
  244. machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
  245. machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
  246. machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
  247. machineconfig/scripts/windows/activate_ve.ps1 +0 -54
  248. machineconfig/setup_linux/web_shortcuts/all.sh +0 -48
  249. machineconfig/setup_linux/web_shortcuts/update_system.sh +0 -48
  250. machineconfig/utils/utils.py +0 -95
  251. /machineconfig/setup_linux/web_shortcuts/{tmp.sh → android.sh} +0 -0
  252. {machineconfig-2.0.dist-info → machineconfig-2.2.dist-info}/WHEEL +0 -0
  253. {machineconfig-2.0.dist-info → machineconfig-2.2.dist-info}/top_level.txt +0 -0
@@ -1,13 +1,14 @@
1
- """devops with emojis
2
- """
1
+ """devops with emojis"""
3
2
 
4
- from machineconfig.utils.utils import display_options, PROGRAM_PATH, write_shell_script_to_default_program_path
3
+ from machineconfig.utils.options import display_options
4
+ from machineconfig.utils.source_of_truth import PROGRAM_PATH
5
+ from machineconfig.utils.code import write_shell_script_to_default_program_path
5
6
  from platform import system
6
7
  from enum import Enum
7
8
  from typing import Optional
8
9
  from rich.console import Console
9
10
  from rich.panel import Panel
10
- from rich import box # Import box
11
+ from rich import box # Import box
11
12
 
12
13
  console = Console()
13
14
 
@@ -15,19 +16,19 @@ BOX_WIDTH = 150 # width for box drawing
15
16
 
16
17
 
17
18
  class Options(Enum):
18
- update = '🔄 UPDATE essential repos'
19
- cli_install = '⚙️ DEVAPPS install'
20
- sym_path_shell = '🔗 SYMLINKS, PATH & SHELL PROFILE'
21
- sym_new = '🆕 SYMLINKS new'
22
- ssh_add_pubkey = '🔑 SSH add pub key to this machine'
23
- ssh_add_id = '🗝️ SSH add identity (private key) to this machine'
24
- ssh_use_pair = '🔐 SSH use key pair to connect two machines'
25
- ssh_setup = '📡 SSH setup'
26
- ssh_setup_wsl = '🐧 SSH setup wsl'
27
- dot_files_sync = '🔗 DOTFILES sync'
28
- backup = '💾 BACKUP'
29
- retreive = '📥 RETRIEVE'
30
- scheduler = '⏰ SCHEDULER'
19
+ update = "🔄 UPDATE essential repos"
20
+ cli_install = "⚙️ DEVAPPS install"
21
+ sym_path_shell = "🔗 SYMLINKS, PATH & SHELL PROFILE"
22
+ sym_new = "🆕 SYMLINKS new"
23
+ ssh_add_pubkey = "🔑 SSH add pub key to this machine"
24
+ ssh_add_id = "🗝️ SSH add identity (private key) to this machine"
25
+ ssh_use_pair = "🔐 SSH use key pair to connect two machines"
26
+ ssh_setup = "📡 SSH setup"
27
+ ssh_setup_wsl = "🐧 SSH setup wsl"
28
+ dot_files_sync = "🔗 DOTFILES sync"
29
+ backup = "💾 BACKUP"
30
+ retreive = "📥 RETRIEVE"
31
+ scheduler = "⏰ SCHEDULER"
31
32
 
32
33
 
33
34
  def args_parser():
@@ -35,6 +36,7 @@ def args_parser():
35
36
  console.print(Panel("🛠️ DevOps Tool Suite", title_align="left", border_style="blue", width=BOX_WIDTH))
36
37
 
37
38
  import argparse
39
+
38
40
  parser = argparse.ArgumentParser()
39
41
  new_line = "\n\n"
40
42
  parser.add_argument("-w", "--which", help=f"""which option to run\nChoose one of those:\n{new_line.join([f"{item.name}: {item.value}" for item in list(Options)])}""", type=str, default=None) # , choices=[op.value for op in Options]
@@ -43,29 +45,36 @@ def args_parser():
43
45
 
44
46
 
45
47
  def display_title(title: str) -> None:
46
- console.print(Panel(title, box=box.DOUBLE_EDGE, title_align="left")) # Replace print with Panel
48
+ console.print(Panel(title, box=box.DOUBLE_EDGE, title_align="left")) # Replace print with Panel
49
+
47
50
 
48
51
  def display_task_title(title: str) -> None:
49
- console.print(Panel(title, box=box.ROUNDED, title_align="left")) # Replace print with Panel
52
+ console.print(Panel(title, box=box.ROUNDED, title_align="left")) # Replace print with Panel
53
+
50
54
 
51
55
  def display_task_status(status: str) -> None:
52
- console.print(Panel(status, box=box.ROUNDED, title_align="left")) # Replace print with Panel
56
+ console.print(Panel(status, box=box.ROUNDED, title_align="left")) # Replace print with Panel
57
+
53
58
 
54
59
  def display_task_result(result: str) -> None:
55
- console.print(Panel(result, box=box.ROUNDED, title_align="left")) # Replace print with Panel
60
+ console.print(Panel(result, box=box.ROUNDED, title_align="left")) # Replace print with Panel
61
+
56
62
 
57
63
  def display_task_error(error: str) -> None:
58
- console.print(Panel(error, box=box.ROUNDED, border_style="red", title_align="left")) # Replace print with Panel
64
+ console.print(Panel(error, box=box.ROUNDED, border_style="red", title_align="left")) # Replace print with Panel
65
+
59
66
 
60
67
  def display_task_warning(warning: str) -> None:
61
- console.print(Panel(warning, box=box.ROUNDED, border_style="yellow", title_align="left")) # Replace print with Panel
68
+ console.print(Panel(warning, box=box.ROUNDED, border_style="yellow", title_align="left")) # Replace print with Panel
69
+
62
70
 
63
71
  def display_task_success(success: str) -> None:
64
- console.print(Panel(success, box=box.ROUNDED, border_style="green", title_align="left")) # Replace print with Panel
72
+ console.print(Panel(success, box=box.ROUNDED, border_style="green", title_align="left")) # Replace print with Panel
65
73
 
66
74
 
67
75
  def main(which: Optional[str] = None):
68
- PROGRAM_PATH.delete(sure=True, verbose=False)
76
+ from machineconfig.utils.path_reduced import PathExtended
77
+ PathExtended(PROGRAM_PATH).delete(sure=True, verbose=False)
69
78
  console.print(Panel("🚀 Initializing DevOps operation...", width=BOX_WIDTH, border_style="blue"))
70
79
 
71
80
  options = [op.value for op in Options]
@@ -75,34 +84,40 @@ def main(which: Optional[str] = None):
75
84
  except KeyboardInterrupt:
76
85
  console.print(Panel("❌ Operation cancelled by user", title_align="left", border_style="red", width=BOX_WIDTH))
77
86
  return
78
- else: choice_key = Options[which].value
87
+ else:
88
+ choice_key = Options[which].value
79
89
 
80
90
  console.print(Panel(f"🔧 SELECTED OPERATION\n{choice_key}", title_align="left", border_style="green", width=BOX_WIDTH))
81
91
 
82
92
  if choice_key == Options.update.value:
83
93
  console.print(Panel("🔄 Updating essential repositories...", width=BOX_WIDTH, border_style="blue"))
84
94
  import machineconfig.scripts.python.devops_update_repos as helper
95
+
85
96
  program = helper.main()
86
97
 
87
98
  elif choice_key == Options.cli_install.value:
88
99
  console.print(Panel("⚙️ Installing development applications...", width=BOX_WIDTH, border_style="blue"))
89
100
  import machineconfig.scripts.python.devops_devapps_install as helper
101
+
90
102
  program = helper.main()
91
103
 
92
104
  elif choice_key == Options.sym_new.value:
93
105
  console.print(Panel("🔄 Creating new symlinks...", width=BOX_WIDTH, border_style="blue"))
94
106
  import machineconfig.jobs.python.python_ve_symlink as helper
107
+
95
108
  program = helper.main()
96
109
 
97
110
  elif choice_key == Options.sym_path_shell.value:
98
111
  console.print(Panel("🔗 Setting up symlinks, PATH, and shell profile...", width=BOX_WIDTH, border_style="blue"))
99
112
  import machineconfig.profile.create as helper
113
+
100
114
  helper.main()
101
115
  program = "echo '✅ done with symlinks'"
102
116
 
103
117
  elif choice_key == Options.ssh_add_pubkey.value:
104
118
  console.print(Panel("🔑 Adding public SSH key to this machine...", width=BOX_WIDTH, border_style="blue"))
105
119
  import machineconfig.scripts.python.devops_add_ssh_key as helper
120
+
106
121
  program = helper.main()
107
122
 
108
123
  elif choice_key == Options.ssh_use_pair.value:
@@ -112,6 +127,7 @@ def main(which: Optional[str] = None):
112
127
  elif choice_key == Options.ssh_add_id.value: # so that you can SSH directly withuot pointing to identity key.
113
128
  console.print(Panel("🗝️ Adding SSH identity (private key) to this machine...", width=BOX_WIDTH, border_style="blue"))
114
129
  import machineconfig.scripts.python.devops_add_identity as helper
130
+
115
131
  program = helper.main()
116
132
 
117
133
  elif choice_key == Options.ssh_setup.value:
@@ -127,11 +143,13 @@ def main(which: Optional[str] = None):
127
143
  elif choice_key == Options.backup.value:
128
144
  console.print(Panel("💾 Creating backup...", width=BOX_WIDTH, border_style="blue"))
129
145
  from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve as helper
146
+
130
147
  program = helper(direction="BACKUP")
131
148
 
132
149
  elif choice_key == Options.retreive.value:
133
150
  console.print(Panel("📥 Retrieving backup...", width=BOX_WIDTH, border_style="blue"))
134
151
  from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve as helper
152
+
135
153
  program = helper(direction="RETRIEVE")
136
154
 
137
155
  elif choice_key == Options.scheduler.value:
@@ -143,6 +161,7 @@ def main(which: Optional[str] = None):
143
161
  elif choice_key == Options.dot_files_sync.value:
144
162
  console.print(Panel("🔗 Synchronizing dotfiles...", width=BOX_WIDTH, border_style="blue"))
145
163
  from machineconfig.scripts.python.cloud_repo_sync import main as helper, PathExtended
164
+
146
165
  program = helper(cloud=None, path=str(PathExtended.home() / "dotfiles"), pwd=None, action="ask")
147
166
 
148
167
  else:
@@ -156,6 +175,5 @@ def main(which: Optional[str] = None):
156
175
  write_shell_script_to_default_program_path(program="echo '✨ Done.'", display=False, desc="🔧 Shell script prepared by Python.", preserve_cwd=True, execute=False)
157
176
 
158
177
 
159
-
160
178
  if __name__ == "__main__":
161
179
  args_parser()
@@ -1,9 +1,7 @@
1
- """ID
2
- """
3
-
1
+ """ID"""
4
2
 
5
3
  # from platform import system
6
- from machineconfig.utils.path_reduced import P as PathExtended, modify_text
4
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
7
5
  from machineconfig.utils.options import display_options
8
6
  from rich.panel import Panel
9
7
  from rich.text import Text
@@ -53,35 +51,27 @@ def main():
53
51
 
54
52
  print(Panel("📝 Updating SSH configuration...", expand=False))
55
53
 
56
- # Inline the previous P.modify_text behavior (now deprecated):
54
+ # Inline the previous modify_text behavior (now deprecated):
57
55
  # - If file doesn't exist, seed content with txt_search
58
- # - Then run modify_text to replace/append accordingly and write back
56
+ # - Otherwise, replace a matching line or append if not found
59
57
  if config_path.exists():
60
58
  current = config_path.read_text(encoding="utf-8")
61
59
  print(Panel("✏️ Updated existing SSH config file", expand=False))
62
60
  else:
63
61
  current = txt
64
62
  print(Panel("📄 Created new SSH config file", expand=False))
65
- new_content = modify_text(
66
- txt_raw=current,
67
- txt_search=txt,
68
- txt_alt=txt,
69
- replace_line=True,
70
- notfound_append=True,
71
- prepend=True,
72
- )
63
+ lines = current.split("\n")
64
+ found = False
65
+ for i, line in enumerate(lines):
66
+ if txt in line:
67
+ lines[i] = txt
68
+ found = True
69
+ if not found:
70
+ lines.insert(0, txt)
71
+ new_content = "\n".join(lines)
73
72
  config_path.write_text(new_content, encoding="utf-8")
74
73
 
75
- panel_complete = Panel(
76
- Text(
77
- "✅ SSH IDENTITY CONFIGURATION COMPLETE\n"
78
- "Identity added to SSH config file\n"
79
- "Consider reloading the SSH config to apply changes",
80
- justify="center"
81
- ),
82
- expand=False,
83
- border_style="green"
84
- )
74
+ panel_complete = Panel(Text("✅ SSH IDENTITY CONFIGURATION COMPLETE\nIdentity added to SSH config file\nConsider reloading the SSH config to apply changes", justify="center"), expand=False, border_style="green")
85
75
  program = f"echo '{panel_complete}'"
86
76
 
87
77
  success_message = f"🎉 CONFIGURATION SUCCESSFUL\nIdentity added: {path_to_key.name}\nConfig file: {config_path}"
@@ -90,5 +80,5 @@ def main():
90
80
  return program
91
81
 
92
82
 
93
- if __name__ == '__main__':
83
+ if __name__ == "__main__":
94
84
  pass
@@ -1,13 +1,12 @@
1
- """SSH
2
- """
3
-
1
+ """SSH"""
4
2
 
5
3
  from platform import system
6
- from machineconfig.utils.utils import LIBRARY_ROOT, display_options
7
- from machineconfig.utils.path_reduced import P as PathExtended
4
+ from machineconfig.utils.source_of_truth import LIBRARY_ROOT
5
+ from machineconfig.utils.options import display_options
6
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
8
7
  from rich.console import Console
9
8
  from rich.panel import Panel
10
- from rich import box # Import box
9
+ from rich import box # Import box
11
10
 
12
11
 
13
12
  console = Console()
@@ -46,7 +45,8 @@ def get_add_ssh_key_script(path_to_key: PathExtended):
46
45
  assert place_holder in program, f"This section performs string manipulation on the script {program_path} to add the key to the authorized_keys file. The script has changed and the string {place_holder} is not found."
47
46
  program = program.replace(place_holder, f'$sshfile = "{path_to_key}"')
48
47
  console.print(Panel("🔧 Configured PowerShell script for Windows\n📝 Replaced placeholder with actual key path", title="[bold blue]Configuration[/bold blue]"))
49
- else: raise NotImplementedError
48
+ else:
49
+ raise NotImplementedError
50
50
  else:
51
51
  console.print(Panel(f"📝 Creating new authorized_keys file\n🔑 Using key: {path_to_key.name}", title="[bold blue]Action[/bold blue]"))
52
52
  if system() == "Linux":
@@ -114,5 +114,5 @@ def main():
114
114
  return program
115
115
 
116
116
 
117
- if __name__ == '__main__':
117
+ if __name__ == "__main__":
118
118
  pass
@@ -1,10 +1,11 @@
1
- """BR: Backup and Retrieve
2
- """
1
+ """BR: Backup and Retrieve"""
3
2
 
4
3
  # import subprocess
5
- from machineconfig.utils.path_reduced import P as PathExtended
4
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
6
5
  from machineconfig.utils.utils2 import read_ini, read_toml
7
- from machineconfig.utils.utils import LIBRARY_ROOT, DEFAULTS_PATH, print_code, choose_cloud_interactively, choose_multiple_options
6
+ from machineconfig.utils.source_of_truth import LIBRARY_ROOT, DEFAULTS_PATH
7
+ from machineconfig.utils.code import print_code
8
+ from machineconfig.utils.options import choose_cloud_interactively, choose_multiple_options
8
9
  from machineconfig.scripts.python.helpers.helpers2 import ES
9
10
  from platform import system
10
11
  from typing import Any, Literal, Optional
@@ -19,7 +20,7 @@ def main_backup_retrieve(direction: OPTIONS, which: Optional[str] = None):
19
20
  console = Console()
20
21
 
21
22
  try:
22
- cloud: str = read_ini(DEFAULTS_PATH)['general']['rclone_config_name']
23
+ cloud: str = read_ini(DEFAULTS_PATH)["general"]["rclone_config_name"]
23
24
  console.print(Panel(f"⚠️ DEFAULT CLOUD CONFIGURATION\n🌥️ Using default cloud: {cloud}", title="[bold blue]Cloud Configuration[/bold blue]", border_style="blue"))
24
25
  except (FileNotFoundError, KeyError, IndexError):
25
26
  console.print(Panel("🔍 DEFAULT CLOUD NOT FOUND\n🔄 Please select a cloud configuration from the options below", title="[bold red]Error: Cloud Not Found[/bold red]", border_style="red"))
@@ -38,7 +39,7 @@ def main_backup_retrieve(direction: OPTIONS, which: Optional[str] = None):
38
39
 
39
40
  if which is None:
40
41
  console.print(Panel(f"🔍 SELECT {direction} ITEMS\n📋 Choose which configuration entries to process", title="[bold blue]Select Items[/bold blue]", border_style="blue"))
41
- choices = choose_multiple_options(msg=f"WHICH FILE of the following do you want to {direction}?", options=['all'] + list(bu_file.keys()))
42
+ choices = choose_multiple_options(msg=f"WHICH FILE of the following do you want to {direction}?", options=["all"] + list(bu_file.keys()))
42
43
  else:
43
44
  choices = which.split(",") if which else []
44
45
  console.print(Panel(f"🔖 PRE-SELECTED ITEMS\n📝 Using: {', '.join(choices)}", title="[bold blue]Pre-selected Items[/bold blue]", border_style="blue"))
@@ -52,19 +53,20 @@ def main_backup_retrieve(direction: OPTIONS, which: Optional[str] = None):
52
53
  program = f"""$cloud = "{cloud}:{ES}" \n """ if system() == "Windows" else f"""cloud="{cloud}:{ES}" \n """
53
54
  console.print(Panel(f"🚀 GENERATING {direction} SCRIPT\n🌥️ Cloud: {cloud}\n🗂️ Items: {len(items)}", title="[bold blue]Script Generation[/bold blue]", border_style="blue"))
54
55
  for item_name, item in items.items():
55
- flags = ''
56
- flags += 'z' if item['zip'] == 'True' else ''
57
- flags += 'e' if item['encrypt'] == 'True' else ''
58
- flags += 'r' if item['rel2home'] == 'True' else ''
59
- flags += 'o' if system().lower() in item_name else ''
56
+ flags = ""
57
+ flags += "z" if item["zip"] == "True" else ""
58
+ flags += "e" if item["encrypt"] == "True" else ""
59
+ flags += "r" if item["rel2home"] == "True" else ""
60
+ flags += "o" if system().lower() in item_name else ""
60
61
  console.print(Panel(f"📦 PROCESSING: {item_name}\n📂 Path: {PathExtended(item['path']).as_posix()}\n🏳️ Flags: {flags or 'None'}", title=f"[bold blue]Processing Item: {item_name}[/bold blue]", border_style="blue"))
61
- if flags: flags = "-" + flags
62
+ if flags:
63
+ flags = "-" + flags
62
64
  if direction == "BACKUP":
63
- program += f"""\ncloud_copy "{PathExtended(item['path']).as_posix()}" $cloud {flags}\n"""
65
+ program += f"""\ncloud_copy "{PathExtended(item["path"]).as_posix()}" $cloud {flags}\n"""
64
66
  elif direction == "RETRIEVE":
65
- program += f"""\ncloud_copy $cloud "{PathExtended(item['path']).as_posix()}" {flags}\n"""
67
+ program += f"""\ncloud_copy $cloud "{PathExtended(item["path"]).as_posix()}" {flags}\n"""
66
68
  else:
67
- console.print(Panel("❌ ERROR: INVALID DIRECTION\n⚠️ Direction must be either \"BACKUP\" or \"RETRIEVE\"", title="[bold red]Error: Invalid Direction[/bold red]", border_style="red"))
69
+ console.print(Panel('❌ ERROR: INVALID DIRECTION\n⚠️ Direction must be either "BACKUP" or "RETRIEVE"', title="[bold red]Error: Invalid Direction[/bold red]", border_style="red"))
68
70
  raise RuntimeError(f"Unknown direction: {direction}")
69
71
  if item_name == "dotfiles" and system() == "Linux":
70
72
  program += """\nchmod 700 ~/.ssh/*\n"""
@@ -80,7 +82,7 @@ def main(direction: OPTIONS, which: Optional[str] = None):
80
82
  console.print(Panel(f"🔄 {direction} OPERATION STARTED\n⏱️ {'-' * 58}", title="[bold blue]Operation Initiated[/bold blue]", border_style="blue"))
81
83
 
82
84
  code = main_backup_retrieve(direction=direction, which=which)
83
- from machineconfig.utils.utils import write_shell_script_to_default_program_path
85
+ from machineconfig.utils.code import write_shell_script_to_default_program_path
84
86
 
85
87
  console.print(Panel("💾 GENERATING SHELL SCRIPT\n📄 Filename: backup_retrieve.sh", title="[bold blue]Shell Script Generation[/bold blue]", border_style="blue"))
86
88
 
@@ -1,10 +1,10 @@
1
- """Devops Devapps Install
2
- """
1
+ """Devops Devapps Install"""
3
2
 
4
3
  # import subprocess
5
4
  from machineconfig.utils.installer_utils.installer_class import Installer
6
5
  from tqdm import tqdm
7
- from machineconfig.utils.utils import LIBRARY_ROOT, choose_multiple_options
6
+ from machineconfig.utils.source_of_truth import LIBRARY_ROOT
7
+ from machineconfig.utils.options import choose_multiple_options
8
8
  from machineconfig.utils.installer import get_installers, install_all, get_all_dicts
9
9
  from platform import system
10
10
  from typing import Any, Optional, Literal, TypeAlias, get_args
@@ -14,13 +14,12 @@ WHICH_CAT: TypeAlias = Literal["AllEssentials", "EssentialsAndOthers", "SystemIn
14
14
 
15
15
 
16
16
  def main(which: Optional[WHICH_CAT | str] = None):
17
-
18
17
  if which is not None and which in get_args(WHICH_CAT): # install by category
19
18
  return get_programs_by_category(program_name=which) # type: ignore
20
19
 
21
20
  if which is not None: # install by name
22
21
  program_total = ""
23
- for a_which in (which.split(",") if type(which) == str else which):
22
+ for a_which in which.split(",") if type(which) == str else which:
24
23
  kv = {}
25
24
  for _category, v in get_all_dicts(system=system()).items():
26
25
  kv.update(v)
@@ -70,12 +69,14 @@ def get_programs_by_category(program_name: WHICH_CAT):
70
69
  program = ""
71
70
 
72
71
  case "SystemInstallers":
73
- if system() == "Windows": options_system = parse_apps_installer_windows(LIBRARY_ROOT.joinpath("setup_windows/apps.ps1").read_text(encoding="utf-8"))
72
+ if system() == "Windows":
73
+ options_system = parse_apps_installer_windows(LIBRARY_ROOT.joinpath("setup_windows/apps.ps1").read_text(encoding="utf-8"))
74
74
  elif system() == "Linux":
75
75
  options_system_1 = parse_apps_installer_linux(LIBRARY_ROOT.joinpath("setup_linux/apps_dev.sh").read_text(encoding="utf-8"))
76
76
  options_system_2 = parse_apps_installer_linux(LIBRARY_ROOT.joinpath("setup_linux/apps.sh").read_text(encoding="utf-8"))
77
77
  options_system = {**options_system_1, **options_system_2}
78
- else: raise NotImplementedError(f"❌ System {system()} not supported")
78
+ else:
79
+ raise NotImplementedError(f"❌ System {system()} not supported")
79
80
  program_names = choose_multiple_options(msg="", options=sorted(list(options_system.keys())), header="🚀 CHOOSE DEV APP")
80
81
  program = ""
81
82
  for name in program_names:
@@ -84,7 +85,8 @@ def get_programs_by_category(program_name: WHICH_CAT):
84
85
  │ ⚙️ Installing: {name}
85
86
  └────────────────────────────────────────────────────""")
86
87
  sub_program = options_system[name]
87
- if sub_program.startswith("#winget"): sub_program = sub_program[1:]
88
+ if sub_program.startswith("#winget"):
89
+ sub_program = sub_program[1:]
88
90
  program += "\n" + sub_program
89
91
 
90
92
  # case "OtherDevApps":
@@ -105,7 +107,7 @@ def get_programs_by_category(program_name: WHICH_CAT):
105
107
  # print(f"Installing {name}")
106
108
  # sub_program = installers[idx].install_robust(version=None) # finish the task
107
109
 
108
- case "PrecheckedCloudInstaller":
110
+ case "PrecheckedCloudInstaller":
109
111
  # from machineconfig.jobs.python.check_installations import PrecheckedCloudInstaller
110
112
  # ci = PrecheckedCloudInstaller()
111
113
  # ci.download_safe_apps(name="AllEssentials")
@@ -119,15 +121,15 @@ def parse_apps_installer_linux(txt: str) -> dict[str, Any]:
119
121
  res = {}
120
122
  for chunk in txts[1:]:
121
123
  try:
122
- k = chunk.split('----')[0].rstrip().lstrip()
124
+ k = chunk.split("----")[0].rstrip().lstrip()
123
125
  v = "\n".join(chunk.split("\n")[1:])
124
126
  res[k] = v
125
127
  except IndexError as e:
126
128
  print(f"""
127
129
  ❌ Error parsing chunk:
128
- {'-' * 50}
130
+ {"-" * 50}
129
131
  {chunk}
130
- {'-' * 50}""")
132
+ {"-" * 50}""")
131
133
  raise e
132
134
  return res
133
135
 
@@ -135,28 +137,31 @@ def parse_apps_installer_linux(txt: str) -> dict[str, Any]:
135
137
  def parse_apps_installer_windows(txt: str) -> dict[str, Any]:
136
138
  chunks: list[str] = []
137
139
  for idx, item in enumerate(txt.split(sep="winget install")):
138
- if idx == 0: continue
139
- if idx == 1: chunks.append(item)
140
- else: chunks.append("winget install" + item)
140
+ if idx == 0:
141
+ continue
142
+ if idx == 1:
143
+ chunks.append(item)
144
+ else:
145
+ chunks.append("winget install" + item)
141
146
  # progs = L(txt.splitlines()).filter(lambda x: x.startswith("winget ") or x.startswith("#winget"))
142
147
  res: dict[str, str] = {}
143
148
  for a_chunk in chunks:
144
149
  try:
145
- name = a_chunk.split('--name ')[1]
150
+ name = a_chunk.split("--name ")[1]
146
151
  if "--Id" not in name:
147
152
  print(f"⚠️ Warning: {name} does not have an Id, skipping")
148
153
  continue
149
- name = name.split(' --Id ', maxsplit=1)[0].strip('"').strip('"')
154
+ name = name.split(" --Id ", maxsplit=1)[0].strip('"').strip('"')
150
155
  res[name] = a_chunk
151
156
  except IndexError as e:
152
157
  print(f"""
153
158
  ❌ Error parsing chunk:
154
- {'-' * 50}
159
+ {"-" * 50}
155
160
  {a_chunk}
156
- {'-' * 50}""")
161
+ {"-" * 50}""")
157
162
  raise e
158
163
  return res
159
164
 
160
165
 
161
- if __name__ == '__main__':
166
+ if __name__ == "__main__":
162
167
  pass