machineconfig 1.94__py3-none-any.whl → 1.95__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 (120) hide show
  1. machineconfig/cluster/data_transfer.py +2 -1
  2. machineconfig/cluster/job_params.py +1 -1
  3. machineconfig/cluster/script_execution.py +1 -1
  4. machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
  5. machineconfig/jobs/linux/msc/lid.sh +2 -4
  6. machineconfig/jobs/linux/msc/network.sh +3 -6
  7. machineconfig/jobs/python/check_installations.py +6 -6
  8. machineconfig/jobs/python/checkout_version.py +4 -4
  9. machineconfig/jobs/python/python_cargo_build_share.py +2 -2
  10. machineconfig/jobs/python/python_ve_symlink.py +4 -4
  11. machineconfig/jobs/python/vscode/api.py +2 -2
  12. machineconfig/jobs/python/vscode/link_ve.py +4 -4
  13. machineconfig/jobs/python/vscode/select_interpreter.py +4 -4
  14. machineconfig/jobs/python/vscode/sync_code.py +6 -6
  15. machineconfig/jobs/python_custom_installers/archive/ngrok.py +4 -4
  16. machineconfig/jobs/python_custom_installers/dev/aider.py +4 -4
  17. machineconfig/jobs/python_custom_installers/dev/alacritty.py +4 -4
  18. machineconfig/jobs/python_custom_installers/dev/brave.py +4 -4
  19. machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +4 -4
  20. machineconfig/jobs/python_custom_installers/dev/code.py +4 -4
  21. machineconfig/jobs/python_custom_installers/dev/docker.py +4 -4
  22. machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +4 -4
  23. machineconfig/jobs/python_custom_installers/dev/espanso.py +8 -8
  24. machineconfig/jobs/python_custom_installers/dev/goes.py +4 -4
  25. machineconfig/jobs/python_custom_installers/dev/lvim.py +4 -4
  26. machineconfig/jobs/python_custom_installers/dev/nerdfont.py +4 -4
  27. machineconfig/jobs/python_custom_installers/dev/redis.py +4 -4
  28. machineconfig/jobs/python_custom_installers/dev/warp-cli.py +4 -4
  29. machineconfig/jobs/python_custom_installers/dev/wezterm.py +4 -4
  30. machineconfig/jobs/python_custom_installers/gh.py +6 -6
  31. machineconfig/jobs/python_custom_installers/hx.py +28 -58
  32. machineconfig/jobs/python_custom_installers/scripts/linux/brave.sh +4 -8
  33. machineconfig/jobs/python_custom_installers/scripts/linux/docker.sh +5 -10
  34. machineconfig/jobs/python_custom_installers/scripts/linux/docker_start.sh +3 -6
  35. machineconfig/jobs/python_custom_installers/scripts/linux/edge.sh +3 -6
  36. machineconfig/jobs/python_custom_installers/scripts/linux/nerdfont.sh +5 -10
  37. machineconfig/jobs/python_custom_installers/scripts/linux/pgsql.sh +4 -8
  38. machineconfig/jobs/python_custom_installers/scripts/linux/redis.sh +5 -10
  39. machineconfig/jobs/python_custom_installers/scripts/linux/timescaledb.sh +6 -12
  40. machineconfig/jobs/python_custom_installers/scripts/linux/vscode.sh +9 -8
  41. machineconfig/jobs/python_custom_installers/scripts/linux/warp-cli.sh +5 -10
  42. machineconfig/jobs/python_custom_installers/scripts/linux/wezterm.sh +3 -6
  43. machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  44. machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  45. machineconfig/profile/shell.py +26 -47
  46. machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
  47. machineconfig/scripts/cloud/init.sh +9 -18
  48. machineconfig/scripts/linux/fire +5 -24
  49. machineconfig/scripts/linux/share_cloud.sh +6 -12
  50. machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
  51. machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
  52. machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
  53. machineconfig/scripts/python/__pycache__/cloud_repo_sync.cpython-311.pyc +0 -0
  54. machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
  55. machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
  56. machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
  57. machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
  58. machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
  59. machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
  60. machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
  61. machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
  62. machineconfig/scripts/python/archive/im2text.py +30 -30
  63. machineconfig/scripts/python/archive/tmate_conn.py +10 -13
  64. machineconfig/scripts/python/archive/tmate_start.py +12 -16
  65. machineconfig/scripts/python/choose_wezterm_theme.py +9 -18
  66. machineconfig/scripts/python/cloud_copy.py +38 -93
  67. machineconfig/scripts/python/cloud_manager.py +61 -53
  68. machineconfig/scripts/python/cloud_mount.py +23 -34
  69. machineconfig/scripts/python/cloud_repo_sync.py +20 -69
  70. machineconfig/scripts/python/cloud_sync.py +35 -45
  71. machineconfig/scripts/python/croshell.py +48 -73
  72. machineconfig/scripts/python/devops.py +50 -104
  73. machineconfig/scripts/python/devops_add_identity.py +41 -101
  74. machineconfig/scripts/python/devops_add_ssh_key.py +33 -140
  75. machineconfig/scripts/python/devops_backup_retrieve.py +23 -112
  76. machineconfig/scripts/python/devops_devapps_install.py +0 -4
  77. machineconfig/scripts/python/devops_update_repos.py +1 -1
  78. machineconfig/scripts/python/fire_jobs.py +73 -25
  79. machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
  80. machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
  81. machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
  82. machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
  83. machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
  84. machineconfig/scripts/python/helpers/cloud_helpers.py +37 -34
  85. machineconfig/scripts/python/helpers/helpers2.py +17 -31
  86. machineconfig/scripts/python/helpers/repo_sync_helpers.py +19 -54
  87. machineconfig/scripts/python/pomodoro.py +1 -1
  88. machineconfig/scripts/python/repos.py +49 -34
  89. machineconfig/scripts/python/wifi_conn.py +5 -3
  90. machineconfig/scripts/windows/fire.ps1 +27 -15
  91. machineconfig/settings/__pycache__/__init__.cpython-311.pyc +0 -0
  92. machineconfig/settings/shells/ipy/profiles/default/__pycache__/__init__.cpython-311.pyc +0 -0
  93. machineconfig/settings/shells/ipy/profiles/default/startup/__pycache__/__init__.cpython-311.pyc +0 -0
  94. machineconfig/settings/shells/ipy/profiles/default/startup/__pycache__/playext.cpython-311.pyc +0 -0
  95. machineconfig/setup_linux/nix/cli_installation.sh +9 -18
  96. machineconfig/setup_linux/others/openssh-server_add_pub_key.sh +3 -6
  97. machineconfig/setup_linux/web_shortcuts/all.sh +5 -10
  98. machineconfig/setup_linux/web_shortcuts/ascii_art.sh +7 -14
  99. machineconfig/setup_linux/web_shortcuts/croshell.sh +6 -12
  100. machineconfig/setup_linux/web_shortcuts/interactive.sh +34 -68
  101. machineconfig/setup_linux/web_shortcuts/ssh.sh +8 -16
  102. machineconfig/setup_linux/web_shortcuts/update_system.sh +7 -14
  103. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +16 -12
  104. machineconfig/utils/ai/browser_user_wrapper.py +60 -45
  105. machineconfig/utils/ai/generate_file_checklist.py +4 -7
  106. machineconfig/utils/ai/url2md.py +13 -5
  107. machineconfig/utils/{utils_code.py → code.py} +4 -10
  108. machineconfig/utils/installer.py +4 -10
  109. machineconfig/utils/{utils_links.py → links.py} +9 -20
  110. machineconfig/utils/{utils_options.py → options.py} +10 -20
  111. machineconfig/utils/{utils_path.py → path.py} +28 -80
  112. machineconfig/utils/procs.py +26 -30
  113. machineconfig/utils/scheduling.py +11 -11
  114. machineconfig/utils/utils.py +12 -19
  115. machineconfig/utils/ve.py +5 -21
  116. machineconfig/utils/ve_utils/ve2.py +15 -2
  117. {machineconfig-1.94.dist-info → machineconfig-1.95.dist-info}/METADATA +4 -2
  118. {machineconfig-1.94.dist-info → machineconfig-1.95.dist-info}/RECORD +120 -118
  119. {machineconfig-1.94.dist-info → machineconfig-1.95.dist-info}/WHEEL +1 -1
  120. {machineconfig-1.94.dist-info → machineconfig-1.95.dist-info}/top_level.txt +0 -0
@@ -1,28 +1,28 @@
1
-
2
-
3
1
  from crocodile.core import Struct
4
2
  from crocodile.file_management import Read
5
3
  from machineconfig.scripts.python.helpers.cloud_helpers import Args, ArgsDefaults, absolute, find_cloud_config, get_secure_share_cloud_config
6
4
  from machineconfig.utils.utils import DEFAULTS_PATH
7
5
  from typing import Optional
6
+ from rich.console import Console
7
+ from rich.panel import Panel
8
8
 
9
9
 
10
10
  ES = "^" # chosen carefully to not mean anything on any shell. `$` was a bad choice.
11
+ console = Console()
11
12
 
12
13
 
13
14
  def parse_cloud_source_target(args: Args, source: str, target: str) -> tuple[str, str, str]:
15
+ print("Source:", source)
16
+ print("Target:", target)
14
17
  config = args.config
15
18
  if config == "ss":
16
19
  cloud_maybe: Optional[str] = target.split(":")[0]
17
- if cloud_maybe == "": cloud_maybe = source.split(":")[0]
20
+ # if cloud_maybe == "": cloud_maybe = source.split(":")[0]
18
21
  if cloud_maybe == "": cloud_maybe = None
22
+ print("cloud_maybe:", cloud_maybe)
19
23
  maybe_config = get_secure_share_cloud_config(interactive=True, cloud=cloud_maybe)
20
24
  elif config is not None:
21
- print(f"""
22
- ╭{'─' * 70}╮
23
- │ 📄 Loading configuration from: {config} │
24
- ╰{'─' * 70}╯
25
- """)
25
+ console.print(Panel(f"📄 Loading configuration from: {config}", width=150, border_style="blue"))
26
26
  maybe_config = Args.from_config(absolute(config))
27
27
  else:
28
28
  maybe_config = None
@@ -55,11 +55,7 @@ def parse_cloud_source_target(args: Args, source: str, target: str) -> tuple[str
55
55
 
56
56
  if maybe_config is None:
57
57
  default_cloud: str=Read.ini(DEFAULTS_PATH)['general']['rclone_config_name']
58
- print(f"""
59
- ╭{'─' * 70}╮
60
- │ âš ī¸ No cloud config found. Using default cloud: {default_cloud} │
61
- ╰{'─' * 70}╯
62
- """)
58
+ console.print(Panel(f"âš ī¸ No cloud config found. Using default cloud: {default_cloud}", width=150, border_style="yellow"))
63
59
  source = default_cloud + ":" + source[1:]
64
60
  else:
65
61
  tmp = maybe_config
@@ -74,18 +70,17 @@ def parse_cloud_source_target(args: Args, source: str, target: str) -> tuple[str
74
70
  if target.startswith(":"): # default cloud name is omitted cloud_name: # or ES in target
75
71
  assert ES not in source, "Not Implemented here yet."
76
72
  path = absolute(source)
77
- if maybe_config is None: maybe_config = find_cloud_config(path)
73
+ if maybe_config is None:
74
+ maybe_config = find_cloud_config(path)
78
75
 
79
76
  if maybe_config is None:
80
77
  default_cloud = Read.ini(DEFAULTS_PATH)['general']['rclone_config_name']
81
- print(f"""
82
- ╭{'─' * 70}╮
83
- │ âš ī¸ No cloud config found. Using default cloud: {default_cloud} │
84
- ╰{'─' * 70}╯
85
- """)
78
+ console.print(Panel(f"âš ī¸ No cloud config found. Using default cloud: {default_cloud}", width=150, border_style="yellow"))
86
79
  target = default_cloud + ":" + target[1:]
80
+ print("target mutated to:", target, f"because of default cloud being {default_cloud}")
87
81
  else:
88
82
  tmp = maybe_config
83
+ # print("target mutated to:", target, f"because of cloud config being {tmp.cloud}")
89
84
  target = f"{tmp.cloud}:" + target[1:]
90
85
  root = tmp.root
91
86
  rel2home = tmp.rel2home
@@ -131,19 +126,10 @@ def parse_cloud_source_target(args: Args, source: str, target: str) -> tuple[str
131
126
  if zip_arg and ".zip" not in target: target += ".zip"
132
127
  if encrypt and ".enc" not in target: target += ".enc"
133
128
  else:
134
- raise ValueError(f"""
135
- ╔{'═' * 70}╗
136
- ║ ❌ ERROR: Invalid path configuration ║
137
- ╠{'═' * 70}â•Ŗ
138
- ║ Either source or target must be a remote path (i.e. machine:path) ║
139
- ╚{'═' * 70}╝
140
- """)
129
+ console.print(Panel("❌ ERROR: Invalid path configuration\nEither source or target must be a remote path (i.e. machine:path)", title="[bold red]Error[/bold red]", border_style="red"))
130
+ raise ValueError(f"Either source or target must be a remote path (i.e. machine:path)\nGot: source: `{source}`, target: `{target}`")
141
131
 
142
- print(f"""
143
- ╭{'─' * 70}╮
144
- │ 🔍 Path resolution complete │
145
- ╰{'─' * 70}╯
146
- """)
132
+ console.print(Panel("🔍 Path resolution complete", title="[bold blue]Resolution[/bold blue]", border_style="blue"))
147
133
  Struct({"cloud": cloud, "source": str(source), "target": str(target)}).print(as_config=True, title="CLI Resolution")
148
134
  _ = pwd, encrypt, zip_arg, share
149
135
  return cloud, str(source), str(target)
@@ -1,17 +1,17 @@
1
-
2
1
  from crocodile.file_management import P, Read
3
2
  from crocodile.meta import Terminal
4
3
  from machineconfig.scripts.python.get_zellij_cmd import get_zellij_cmd
5
- from machineconfig.utils.utils import CONFIG_PATH, DEFAULTS_PATH, get_shell_script, write_shell_script
4
+ from machineconfig.utils.utils import CONFIG_PATH, DEFAULTS_PATH
5
+ from machineconfig.utils.code import write_shell_script_to_file
6
6
  import platform
7
+ from rich.console import Console
8
+ from rich.panel import Panel
9
+
10
+ console = Console()
7
11
 
8
12
 
9
13
  def delete_remote_repo_copy_and_push_local(remote_repo: str, local_repo: str, cloud: str):
10
- print(f"""
11
- ╔{'═' * 70}╗
12
- ║ đŸ—‘ī¸ Deleting remote repo copy and pushing local copy ║
13
- ╚{'═' * 70}╝
14
- """)
14
+ console.print(Panel("đŸ—‘ī¸ Deleting remote repo copy and pushing local copy", title="[bold blue]Repo Sync[/bold blue]", border_style="blue"))
15
15
  repo_sync_root = P(remote_repo).expanduser().absolute()
16
16
  repo_root_path = P(local_repo).expanduser().absolute()
17
17
  repo_sync_root.delete(sure=True)
@@ -20,21 +20,13 @@ def delete_remote_repo_copy_and_push_local(remote_repo: str, local_repo: str, cl
20
20
  from git.repo import Repo
21
21
  try:
22
22
  Remote.remove(Repo(repo_root_path), "originEnc")
23
- print("🔗 Removed originEnc remote reference")
23
+ console.print(Panel("🔗 Removed originEnc remote reference", border_style="blue"))
24
24
  except Exception: pass # type: ignore
25
- print(f"""
26
- ╭{'─' * 70}╮
27
- │ 📤 Uploading local repository to cloud... │
28
- ╰{'─' * 70}╯
29
- """)
25
+ console.print(Panel(f"📈 Deleting remote repository copy and pushing local changes", width=150, border_style="blue"))
30
26
 
31
27
  repo_root_path.to_cloud(cloud=cloud, zip=True, encrypt=True, rel2home=True, os_specific=False)
32
28
 
33
- print(f"""
34
- ╔{'═' * 70}╗
35
- ║ ✅ Repository successfully pushed to cloud ║
36
- ╚{'═' * 70}╝
37
- """)
29
+ console.print(Panel("✅ Repository successfully pushed to cloud", title="[bold green]Repo Sync[/bold green]", border_style="green"))
38
30
 
39
31
 
40
32
  # import sys
@@ -50,59 +42,36 @@ def get_wt_cmd(wd1: P, wd2: P) -> str:
50
42
 
51
43
 
52
44
  def inspect_repos(repo_local_root: str, repo_remote_root: str):
53
- print(f"""
54
- ╔{'═' * 70}╗
55
- ║ 🔍 Inspecting Repositories ║
56
- ╠{'═' * 70}â•Ŗ
57
- ║ 📂 Local: {repo_local_root}
58
- ║ 📂 Remote: {repo_remote_root}
59
- ╚{'═' * 70}╝
60
- """)
45
+ console.print(Panel(f"📂 Local: {repo_local_root}\n📂 Remote: {repo_remote_root}", title="[bold blue]🔍 Inspecting Repositories[/bold blue]", border_style="blue"))
61
46
 
62
47
  if platform.system() == "Windows":
63
48
  program = get_wt_cmd(wd1=P(repo_local_root), wd2=P(repo_local_root))
64
- write_shell_script(program=program, execute=True, desc="Inspecting repos ...", preserve_cwd=True, display=True)
49
+ write_shell_script_to_file(program=program, execute=True, desc="Inspecting repos ...", preserve_cwd=True, display=True)
65
50
  return None
66
51
  elif platform.system() == "Linux":
67
52
  program = get_zellij_cmd(wd1=P(repo_local_root), wd2=P(repo_remote_root))
68
- write_shell_script(program=program, execute=True, desc="Inspecting repos ...", preserve_cwd=True, display=True)
53
+ write_shell_script_to_file(program=program, execute=True, desc="Inspecting repos ...", preserve_cwd=True, display=True)
69
54
  return None
70
55
  else: raise NotImplementedError(f"Platform {platform.system()} not implemented.")
71
56
 
72
57
 
73
58
  def fetch_dotfiles():
74
- print(f"""
75
- ╔{'═' * 70}╗
76
- ║ 📁 Fetching Dotfiles ║
77
- ╚{'═' * 70}╝
78
- """)
59
+ console.print(Panel("📁 Fetching Dotfiles", title="[bold blue]Dotfiles[/bold blue]", border_style="blue"))
79
60
 
80
61
  cloud_resolved = Read.ini(DEFAULTS_PATH)['general']['rclone_config_name']
81
- print(f"""
82
- ╭{'─' * 70}╮
83
- │ âš ī¸ Using default cloud: `{cloud_resolved}` from {DEFAULTS_PATH} │
84
- ╰{'─' * 70}╯
85
- """)
62
+ console.print(Panel(f"âš ī¸ Using default cloud: `{cloud_resolved}` from {DEFAULTS_PATH}", width=150, border_style="yellow"))
86
63
 
87
64
  dotfiles_local = P.home().joinpath("dotfiles")
88
65
  CONFIG_PATH.joinpath("remote").create()
89
66
  dotfiles_remote = CONFIG_PATH.joinpath("remote", dotfiles_local.rel2home())
90
67
  remote_path = dotfiles_local.get_remote_path(rel2home=True, os_specific=False, root="myhome") + ".zip.enc"
91
68
 
92
- print(f"""
93
- ╭{'─' * 70}╮
94
- │ đŸ“Ĩ Downloading dotfiles from cloud... │
95
- ╰{'─' * 70}╯
96
- """)
69
+ console.print(Panel(f"đŸ“Ĩ Downloading dotfiles from cloud...", width=150, border_style="blue"))
97
70
 
98
71
  dotfiles_remote.from_cloud(remotepath=remote_path, cloud=cloud_resolved,
99
72
  unzip=True, decrypt=True, rel2home=True, os_specific=False, pwd=None)
100
73
 
101
- print(f"""
102
- ╭{'─' * 70}╮
103
- │ đŸ—‘ī¸ Removing old dotfiles and replacing with cloud version... │
104
- ╰{'─' * 70}╯
105
- """)
74
+ console.print(Panel(f"đŸ—‘ī¸ Removing old dotfiles and replacing with cloud version...", width=150, border_style="blue"))
106
75
 
107
76
  dotfiles_local.delete(sure=True)
108
77
  dotfiles_remote.move(folder=P.home())
@@ -115,12 +84,8 @@ sudo chmod 600 $HOME/.ssh/*
115
84
  sudo chmod 700 $HOME/.ssh
116
85
  sudo chmod +x $HOME/dotfiles/scripts/linux -R
117
86
  """
118
- shell_path = get_shell_script(shell_script=script)
87
+ shell_path = write_shell_script_to_file(shell_script=script)
119
88
  Terminal().run(f". {shell_path}", shell="bash").capture().print()
120
89
 
121
- print(f"""
122
- ╔{'═' * 70}╗
123
- ║ ✅ Dotfiles successfully fetched and installed ║
124
- ╚{'═' * 70}╝
125
- """)
90
+ console.print(Panel("✅ Dotfiles successfully fetched and installed", title="[bold green]Dotfiles[/bold green]", border_style="green"))
126
91
 
@@ -31,8 +31,8 @@ def pomodoro(work: int = 25, rest: int = 5, repeats: int = 4):
31
31
  def speak(txt: str):
32
32
  print(f"🔊 Speaking: {txt}")
33
33
  install_n_import("gtts").gTTS(txt, lang='en', tld='com.au').save(tmp := P.tmpfile(suffix=".mp3"))
34
- time.sleep(0.5)
35
34
  pyglet = install_n_import("pyglet")
35
+ time.sleep(0.5)
36
36
  pyglet.resource.path = [tmp.parent.to_str()]
37
37
  pyglet.resource.reindex()
38
38
  pyglet.resource.media(tmp.name).play()
@@ -25,11 +25,11 @@ class GitAction(Enum):
25
25
  class RepoRecord:
26
26
  name: str
27
27
  parent_dir: str
28
- remotes: list[str]
28
+ remotes: dict[str, str] # Fixed: should be dict mapping remote name to URL
29
29
  version: dict[str, str]
30
30
 
31
31
 
32
- def git_action(path: P, action: GitAction, mess: Optional[str] = None, r: bool=False) -> str:
32
+ def git_action(path: P, action: GitAction, mess: Optional[str] = None, r: bool = False, uv_sync: bool = False) -> str:
33
33
  from git.exc import InvalidGitRepositoryError
34
34
  from git.repo import Repo
35
35
  try:
@@ -37,25 +37,27 @@ def git_action(path: P, action: GitAction, mess: Optional[str] = None, r: bool=F
37
37
  except InvalidGitRepositoryError:
38
38
  pprint(f"âš ī¸ Skipping {path} because it is not a git repository.")
39
39
  if r:
40
- prgs = [git_action(path=sub_path, action=action, mess=mess, r=r) for sub_path in path.search()]
40
+ prgs = [git_action(path=sub_path, action=action, mess=mess, r=r, uv_sync=uv_sync) for sub_path in path.search()]
41
41
  return "\n".join(prgs)
42
42
  else: return "\necho 'skipped because not a git repo'\n\n"
43
43
 
44
44
  program = f'''
45
- 🔧 echo '>>>>>>>>> {action}'
45
+ echo '>>>>>>>>> 🔧{action}'
46
46
  cd '{path}'
47
47
  '''
48
48
  if action == GitAction.commit:
49
49
  if mess is None: mess = "auto_commit_" + randstr()
50
50
  program += f'''
51
- 🔄 git add .; git commit -am "{mess}"
51
+ git commit -am "{mess}"
52
52
  '''
53
53
  if action == GitAction.push or action == GitAction.pull:
54
54
  action_name = "pull" if action == GitAction.pull else "push"
55
55
  cmds = [f'echo "🔄 {action_name.capitalize()}ing from {remote.url}" ; git {action_name} {remote.name} {repo.active_branch.name}' for remote in repo.remotes]
56
56
  program += '\n' + '\n'.join(cmds) + '\n'
57
- program = program + '''
58
- ✅ echo ""; echo ""
57
+ uv_sync = "uv sync" if uv_sync else ""
58
+ program = program + f'''
59
+ {uv_sync}
60
+ echo "✅"; echo ""
59
61
  '''
60
62
  return program
61
63
 
@@ -70,6 +72,7 @@ def main():
70
72
  parser.add_argument("directory", help="📁 Folder containing repos to record or a specs JSON file to follow.", default="")
71
73
  # FLAGS
72
74
  parser.add_argument("--push", help="🚀 Push changes.", action="store_true")
75
+ parser.add_argument("--uv_sync", help="🔄 Sync UV dependencies.", action="store_true")
73
76
  parser.add_argument("--pull", help="âŦ‡ī¸ Pull changes.", action="store_true")
74
77
  parser.add_argument("--commit", help="💾 Commit changes.", action="store_true")
75
78
  parser.add_argument("--all", help="🔄 Pull, commit, and push changes.", action="store_true")
@@ -98,7 +101,7 @@ def main():
98
101
  elif args.clone or args.checkout or args.checkout_to_branch:
99
102
  print("\nđŸ“Ĩ Cloning or checking out repositories...")
100
103
  program += """\necho '>>>>>>>>> Cloning Repos'\n"""
101
- if not repos_root.exists() or repos_root.stem != 'repos.json': # user didn't pass absolute path to pickle file, but rather expected it to be in the default save location
104
+ if not repos_root.exists() or repos_root.name != 'repos.json': # Fixed: use name instead of stem
102
105
  repos_root = CONFIG_PATH.joinpath("repos").joinpath(repos_root.rel2home()).joinpath("repos.json")
103
106
  if not repos_root.exists():
104
107
  if args.cloud is None:
@@ -111,12 +114,12 @@ def main():
111
114
  assert (repos_root.exists() and repos_root.name == 'repos.json') or args.cloud is not None, f"Path {repos_root} does not exist and cloud was not passed. You can't clone without one of them."
112
115
  program += install_repos(specs_path=str(repos_root), clone=args.clone, checkout_to_recorded_commit=args.checkout, checkout_to_branch=args.checkout_to_branch)
113
116
  elif args.all or args.commit or args.pull or args.push:
114
- print("\n🔄 Performing Git actions on repositories...")
117
+ print(f"\n🔄 Performing Git actions on repositories @ `{repos_root}`...")
115
118
  for a_path in repos_root.search("*"):
116
119
  program += f"""echo "{("Handling " + str(a_path)).center(80, "-")}" """
117
- if args.pull or args.all: program += git_action(path=a_path, action=GitAction.pull, r=args.recursive)
118
- if args.commit or args.all: program += git_action(a_path, action=GitAction.commit, r=args.recursive)
119
- if args.push or args.all: program += git_action(a_path, action=GitAction.push, r=args.recursive)
120
+ if args.pull or args.all: program += git_action(path=a_path, action=GitAction.pull, r=args.recursive, uv_sync=args.uv_sync)
121
+ if args.commit or args.all: program += git_action(a_path, action=GitAction.commit, r=args.recursive, uv_sync=args.uv_sync)
122
+ if args.push or args.all: program += git_action(a_path, action=GitAction.push, r=args.recursive, uv_sync=args.uv_sync)
120
123
  else: program = "echo '❌ No action specified. Try passing --push, --pull, --commit, or --all.'"
121
124
  write_shell_script_to_default_program_path(program=program, desc="Script to update repos", preserve_cwd=True, display=True, execute=False)
122
125
 
@@ -164,28 +167,40 @@ def install_repos(specs_path: str, clone: bool=True, checkout_to_recorded_commit
164
167
  repos: list[dict[str, Any]] = Read.json(path_obj)
165
168
  for repo in repos:
166
169
  parent_dir = P(repo["parent_dir"]).expanduser().absolute().create()
167
- for idx, (remote_name, remote_url) in enumerate(repo["remotes"].items()):
168
- if clone:
169
- if idx == 0: # clone
170
- if preferred_remote is not None:
171
- if preferred_remote in repo["remotes"]:
172
- remote_name = preferred_remote
173
- remote_url = repo["remotes"][preferred_remote]
174
- else:
175
- print(f"âš ī¸ `{preferred_remote=}` not found in {repo['remotes']}.")
176
- program += f"\ncd {parent_dir.collapseuser().as_posix()}; git clone {remote_url} --origin {remote_name}"
177
- program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git remote set-url {remote_name} {remote_url}"
178
- program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git remote add {remote_name} {remote_url}"
179
- if checkout_to_recorded_commit:
180
- commit = repo['version']['commit']
181
- if isinstance(commit, str): program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git checkout {commit}"
182
- else: print(f"Skipping {repo['parent_dir']} because it doesn't have a commit recorded. Found {commit}")
183
- break
184
- if checkout_to_branch:
185
- program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git checkout {repo['current_branch']}"
186
- break
187
- if editable_install and idx == 0:
188
- program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; uv pip install -e ."
170
+
171
+ # Handle cloning and remote setup
172
+ if clone:
173
+ # Select the remote to use for cloning
174
+ remote_name, remote_url = next(iter(repo["remotes"].items())) # Get first remote by default
175
+ if preferred_remote is not None and preferred_remote in repo["remotes"]:
176
+ remote_name = preferred_remote
177
+ remote_url = repo["remotes"][preferred_remote]
178
+ elif preferred_remote is not None:
179
+ print(f"âš ī¸ `{preferred_remote=}` not found in {repo['remotes']}.")
180
+
181
+ # Clone with the selected remote
182
+ program += f"\ncd {parent_dir.collapseuser().as_posix()}; git clone {remote_url} --origin {remote_name} --depth 2"
183
+ program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git remote set-url {remote_name} {remote_url}"
184
+
185
+ # Add any additional remotes
186
+ for other_remote_name, other_remote_url in repo["remotes"].items():
187
+ if other_remote_name != remote_name:
188
+ program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git remote add {other_remote_name} {other_remote_url}"
189
+
190
+ # Handle checkout operations (after all remotes are set up)
191
+ if checkout_to_recorded_commit:
192
+ commit = repo['version']['commit']
193
+ if isinstance(commit, str):
194
+ program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git checkout {commit}"
195
+ else:
196
+ print(f"Skipping {repo['parent_dir']} because it doesn't have a commit recorded. Found {commit}")
197
+ elif checkout_to_branch:
198
+ program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git checkout {repo['current_branch']}"
199
+
200
+ # Handle editable install
201
+ if editable_install:
202
+ program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; uv pip install -e ."
203
+
189
204
  program += "\n"
190
205
  pprint(program)
191
206
  return program
@@ -10,6 +10,10 @@ from pathlib import Path
10
10
  import os
11
11
  import platform
12
12
  import subprocess
13
+ from rich.console import Console
14
+ from rich.panel import Panel
15
+
16
+ console = Console()
13
17
 
14
18
  def create_new_connection(name: str, ssid: str, password: str):
15
19
  print(f"\n🔧 Creating new connection: {name} (SSID: {ssid})")
@@ -45,9 +49,7 @@ def display_available_networks():
45
49
  print("✅ Network scan completed!\n")
46
50
 
47
51
  def main():
48
- print("\n" + "=" * 50)
49
- print("đŸ“ļ Welcome to the WiFi Connector Tool")
50
- print("=" * 50 + "\n")
52
+ console.print(Panel("đŸ“ļ Welcome to the WiFi Connector Tool", title="[bold blue]WiFi Connection[/bold blue]", border_style="blue"))
51
53
 
52
54
  creds = configparser.ConfigParser()
53
55
  creds.read(Path.home().joinpath('dotfiles/machineconfig/setup/wifi.ini'))
@@ -1,18 +1,33 @@
1
1
 
2
- $op_script = "~/tmp_results/shells/python_return_command.ps1"
3
- if (Test-Path $op_script ) {
4
- Remove-Item $op_script
2
+ # param(
3
+ # [switch]$IgnoreKeyboardInterrupt
4
+ # )
5
+
6
+ # Generate a random string of 10 characters
7
+ $random_str = -join ((65..90) + (97..122) + (48..57) | Get-Random -Count 10 | ForEach-Object {[char]$_})
8
+ $op_script = "$HOME\tmp_results\shells\$random_str\python_return_command.ps1"
9
+ # Export the op_script variable to environment so python can access it
10
+ $env:op_script = $op_script
11
+
12
+ # Create directory if it doesn't exist
13
+ $script_dir = Split-Path -Path $op_script -Parent
14
+ if (-not (Test-Path $script_dir)) {
15
+ New-Item -ItemType Directory -Path $script_dir -Force | Out-Null
5
16
  }
6
17
 
18
+ # if (Test-Path $op_script ) {
19
+ # Remove-Item $op_script
20
+ # }
7
21
 
8
- try {
9
- # $null = & chafa --version
10
- # & chafa "$HOME\code\machineconfig\assets\aafire.webp" --speed 2 --duration 1
11
- # Chafa.exe "$HOME\code\machineconfig\assets\aafire.webp" --speed 2 --duration 1 --symbols ascii
12
- Write-Host "đŸ”Ĩ"
13
- } catch {
14
- Write-Host "Chafa not found, skipping."
15
- }
22
+
23
+ # try {
24
+ # # $null = & chafa --version
25
+ # # & chafa "$HOME\code\machineconfig\assets\aafire.webp" --speed 2 --duration 1
26
+ # # Chafa.exe "$HOME\code\machineconfig\assets\aafire.webp" --speed 2 --duration 1 --symbols ascii
27
+ # Write-Host "đŸ”Ĩ"
28
+ # } catch {
29
+ # Write-Host "Chafa not found, skipping."
30
+ # }
16
31
 
17
32
 
18
33
  . "$HOME\scripts\activate_ve.ps1" ve
@@ -21,13 +36,10 @@ python -m machineconfig.scripts.python.fire_jobs $args
21
36
 
22
37
  if (Test-Path $op_script ) {
23
38
  . $op_script
24
- # content of $op_script
25
- # $content = Get-Content $op_script
26
- # Invoke-Expression $content | Add-History # this way, $content will go to hisyory of powershell. You don't neet Add-history
27
39
  }
28
40
  else
29
41
  {
30
- Write-Host "No output script to be executed @ $op_script"
42
+ Write-Host "No output script to be executed at $op_script."
31
43
  }
32
44
 
33
45
  deactivate -ErrorAction SilentlyContinue
@@ -4,8 +4,7 @@
4
4
  #=======================================================================
5
5
  # This script installs various command-line utilities using the Nix package manager
6
6
 
7
- echo """
8
- #=======================================================================
7
+ echo """#=======================================================================
9
8
  🔄 SYSTEM UTILITIES | Installing system management tools
10
9
  #=======================================================================
11
10
  """
@@ -22,8 +21,7 @@ nix-env -iA nixpkgs.procs || true
22
21
  echo "đŸ“Ĩ Installing watchexec - executes commands when files change..."
23
22
  nix-env -iA nixpkgs.watchexec || true
24
23
 
25
- echo """
26
- #=======================================================================
24
+ echo """#=======================================================================
27
25
  📂 FILE MANAGEMENT | Installing file browsers and utilities
28
26
  #=======================================================================
29
27
  """
@@ -58,8 +56,7 @@ nix-env -iA nixpkgs.diskonaut || true
58
56
  echo "đŸ“Ĩ Installing kondo - cleanup tool for dev projects..."
59
57
  nix-env -iA nixpkgs.kondo || true
60
58
 
61
- echo """
62
- #=======================================================================
59
+ echo """#=======================================================================
63
60
  đŸ–ŧī¸ VISUAL TOOLS | Installing terminal visualization tools
64
61
  #=======================================================================
65
62
  """
@@ -74,8 +71,7 @@ nix-env -iA nixpkgs.bottom || true
74
71
  echo "đŸ“Ĩ Installing delta - syntax-highlighting pager for git..."
75
72
  nix-env -iA nixpkgs.delta || true
76
73
 
77
- echo """
78
- #=======================================================================
74
+ echo """#=======================================================================
79
75
  🔧 DEVELOPMENT TOOLS | Installing programming utilities
80
76
  #=======================================================================
81
77
  """
@@ -99,8 +95,7 @@ nix-env -iA nixpkgs.tokei || true
99
95
  echo "đŸ“Ĩ Installing gitui - terminal UI for git..."
100
96
  nix-env -iA nixpkgs.gitui || true
101
97
 
102
- echo """
103
- #=======================================================================
98
+ echo """#=======================================================================
104
99
  🔎 SEARCH TOOLS | Installing fuzzy finders and search utilities
105
100
  #=======================================================================
106
101
  """
@@ -113,8 +108,7 @@ nix-env -iA nixpkgs.mcfly || true
113
108
  echo "đŸ“Ĩ Installing skim - fuzzy finder in Rust..."
114
109
  nix-env -iA nixpkgs.skim || true
115
110
 
116
- echo """
117
- #=======================================================================
111
+ echo """#=======================================================================
118
112
  🌐 NETWORK & CLOUD TOOLS | Installing file transfer and cloud utilities
119
113
  #=======================================================================
120
114
  """
@@ -127,8 +121,7 @@ nix-env -iA nixpkgs.termscp || true
127
121
  echo "đŸ“Ĩ Installing rclone - rsync for cloud storage..."
128
122
  nix-env -iA nixpkgs.rclone || true
129
123
 
130
- echo """
131
- #=======================================================================
124
+ echo """#=======================================================================
132
125
  đŸ›Ąī¸ SECURITY TOOLS | Installing password management utilities
133
126
  #=======================================================================
134
127
  """
@@ -137,8 +130,7 @@ echo """
137
130
  echo "đŸ“Ĩ Installing gopass - team password manager with git..."
138
131
  nix-env -iA nixpkgs.gopass || true
139
132
 
140
- echo """
141
- #=======================================================================
133
+ echo """#=======================================================================
142
134
  📚 DOCUMENTATION | Installing help and reference tools
143
135
  #=======================================================================
144
136
  """
@@ -151,8 +143,7 @@ nix-env -iA nixpkgs.tldr || true
151
143
  echo "đŸ“Ĩ Installing nushell - modern shell alternative..."
152
144
  nix-env -iA nixpkgs.nushell || true
153
145
 
154
- echo """
155
- #=======================================================================
146
+ echo """#=======================================================================
156
147
  ✅ INSTALLATION COMPLETE | All Nix CLI tools have been installed
157
148
  #=======================================================================
158
149
  """
@@ -4,14 +4,12 @@
4
4
  #=======================================================================
5
5
  # This script helps set up passwordless SSH authentication to remote Linux machines
6
6
 
7
- echo """
8
- #=======================================================================
7
+ echo """#=======================================================================
9
8
  â„šī¸ PASSWORDLESS SSH SETUP | Manual instructions for key deployment
10
9
  #=======================================================================
11
10
  """
12
11
 
13
- echo """
14
- 🔐 There are two methods to copy your public key to a remote server:
12
+ echo """🔐 There are two methods to copy your public key to a remote server:
15
13
 
16
14
  📌 METHOD 1: Using ssh-copy-id (Linux clients only)
17
15
  ssh-copy-id username@hostname
@@ -23,8 +21,7 @@ echo """
23
21
  📌 METHOD 3: Using SFTP (detailed below)
24
22
  """
25
23
 
26
- echo """
27
- #=======================================================================
24
+ echo """#=======================================================================
28
25
  📋 MANUAL SFTP PROCESS | Step-by-step instructions
29
26
  #=======================================================================
30
27
 
@@ -4,16 +4,14 @@
4
4
  #=======================================================================
5
5
  # This script provides quick access to installation scripts via web
6
6
 
7
- echo """
8
- #=======================================================================
7
+ echo """#=======================================================================
9
8
  📚 AVAILABLE INSTALLATION OPTIONS | Web-based installers
10
9
  #=======================================================================
11
10
 
12
11
  Choose from the following installation options:
13
12
  """
14
13
 
15
- echo """
16
- #=======================================================================
14
+ echo """#=======================================================================
17
15
  đŸ“Ļ SYSTEM APPLICATIONS | Basic system applications
18
16
  #=======================================================================
19
17
 
@@ -21,8 +19,7 @@ echo """
21
19
  # curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/apps.sh | bash
22
20
  """
23
21
 
24
- echo """
25
- #=======================================================================
22
+ echo """#=======================================================================
26
23
  🐍 PYTHON ENVIRONMENT | Virtual environment setup
27
24
  #=======================================================================
28
25
 
@@ -30,8 +27,7 @@ Setting up Python virtual environment...
30
27
  """
31
28
  curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/ve.sh | bash
32
29
 
33
- echo """
34
- #=======================================================================
30
+ echo """#=======================================================================
35
31
  🔄 CODE REPOSITORIES | Cloning project repositories
36
32
  #=======================================================================
37
33
 
@@ -39,8 +35,7 @@ Setting up code repositories...
39
35
  """
40
36
  curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/repos.sh | bash
41
37
 
42
- echo """
43
- #=======================================================================
38
+ echo """#=======================================================================
44
39
  âš™ī¸ DEVELOPMENT TOOLS | Developer applications
45
40
  #=======================================================================
46
41