machineconfig 5.17__py3-none-any.whl → 5.18__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 (53) hide show
  1. machineconfig/cluster/sessions_managers/wt_local.py +6 -1
  2. machineconfig/cluster/sessions_managers/wt_local_manager.py +4 -2
  3. machineconfig/cluster/sessions_managers/wt_remote_manager.py +4 -2
  4. machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +4 -2
  5. machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
  6. machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +3 -1
  7. machineconfig/profile/create.py +108 -140
  8. machineconfig/profile/create_frontend.py +58 -0
  9. machineconfig/profile/shell.py +45 -9
  10. machineconfig/scripts/python/ai/solutions/_shared.py +9 -1
  11. machineconfig/scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md +1 -1
  12. machineconfig/scripts/python/ai/solutions/generic.py +12 -2
  13. machineconfig/scripts/python/count_lines_frontend.py +1 -1
  14. machineconfig/scripts/python/devops.py +78 -49
  15. machineconfig/scripts/python/dotfile.py +14 -8
  16. machineconfig/scripts/python/interactive.py +3 -21
  17. machineconfig/scripts/python/share_terminal.py +1 -1
  18. machineconfig/setup_linux/__init__.py +11 -0
  19. machineconfig/setup_linux/{openssh_all.sh → ssh/openssh_all.sh} +1 -0
  20. machineconfig/setup_linux/web_shortcuts/interactive.sh +1 -1
  21. machineconfig/setup_windows/__init__.py +12 -0
  22. machineconfig/setup_windows/apps.ps1 +1 -0
  23. machineconfig/setup_windows/{openssh_all.ps1 → ssh/openssh_all.ps1} +5 -5
  24. machineconfig/setup_windows/web_shortcuts/interactive.ps1 +1 -1
  25. machineconfig/utils/code.py +7 -4
  26. machineconfig/utils/files/dbms.py +355 -0
  27. machineconfig/utils/files/read.py +2 -2
  28. machineconfig/utils/installer.py +5 -5
  29. machineconfig/utils/links.py +128 -104
  30. machineconfig/utils/procs.py +4 -4
  31. machineconfig/utils/scheduler.py +10 -14
  32. {machineconfig-5.17.dist-info → machineconfig-5.18.dist-info}/METADATA +1 -1
  33. {machineconfig-5.17.dist-info → machineconfig-5.18.dist-info}/RECORD +41 -51
  34. machineconfig/scripts/windows/dotfile.ps1 +0 -1
  35. machineconfig/setup_linux/others/openssh-server_add_pub_key.sh +0 -57
  36. machineconfig/setup_linux/web_shortcuts/croshell.sh +0 -11
  37. machineconfig/setup_linux/web_shortcuts/ssh.sh +0 -52
  38. machineconfig/setup_windows/symlinks.ps1 +0 -5
  39. machineconfig/setup_windows/symlinks2linux.ps1 +0 -1
  40. machineconfig/setup_windows/web_shortcuts/all.ps1 +0 -18
  41. machineconfig/setup_windows/web_shortcuts/ascii_art.ps1 +0 -36
  42. machineconfig/setup_windows/web_shortcuts/croshell.ps1 +0 -16
  43. machineconfig/setup_windows/web_shortcuts/ssh.ps1 +0 -11
  44. machineconfig/setup_windows/wsl_refresh.ps1 +0 -8
  45. machineconfig/setup_windows/wt_and_pwsh.ps1 +0 -9
  46. /machineconfig/setup_linux/{openssh_wsl.sh → ssh/openssh_wsl.sh} +0 -0
  47. /machineconfig/setup_windows/{quirks.ps1 → others/power_options.ps1} +0 -0
  48. /machineconfig/setup_windows/{openssh-server.ps1 → ssh/openssh-server.ps1} +0 -0
  49. /machineconfig/setup_windows/{openssh-server_add-sshkey.ps1 → ssh/openssh-server_add-sshkey.ps1} +0 -0
  50. /machineconfig/setup_windows/{openssh-server_add_identity.ps1 → ssh/openssh-server_add_identity.ps1} +0 -0
  51. {machineconfig-5.17.dist-info → machineconfig-5.18.dist-info}/WHEEL +0 -0
  52. {machineconfig-5.17.dist-info → machineconfig-5.18.dist-info}/entry_points.txt +0 -0
  53. {machineconfig-5.17.dist-info → machineconfig-5.18.dist-info}/top_level.txt +0 -0
@@ -6,9 +6,19 @@ from machineconfig.utils.source_of_truth import LIBRARY_ROOT
6
6
  def create_dot_scripts(repo_root: Path) -> None:
7
7
  scripts_dir = LIBRARY_ROOT.joinpath("scripts/python/ai/scripts")
8
8
  target_dir = repo_root.joinpath(".scripts")
9
+ import shutil
10
+ shutil.rmtree(target_dir, ignore_errors=True)
9
11
  target_dir.mkdir(parents=True, exist_ok=True)
10
- for script_path in scripts_dir.iterdir():
11
- target_dir.joinpath(script_path.name).write_text(data=script_path.read_text(encoding="utf-8"), encoding="utf-8")
12
+ # for script_path in scripts_dir.iterdir():
13
+ # target_dir.joinpath(script_path.name).write_text(data=script_path.read_text(encoding="utf-8"), encoding="utf-8")
14
+ import platform
15
+ if platform.system() == "Windows":
16
+ script_path = scripts_dir.joinpath("lint_and_type_check.ps1")
17
+ elif platform.system() in ["Linux", "Darwin"]:
18
+ script_path = scripts_dir.joinpath("lint_and_type_check.sh")
19
+ else:
20
+ raise NotImplementedError(f"Platform {platform.system()} is not supported.")
21
+ target_dir.joinpath(script_path.name).write_text(data=script_path.read_text(encoding="utf-8"), encoding="utf-8")
12
22
 
13
23
 
14
24
  def adjust_gitignore(repo_root: Path) -> None:
@@ -6,7 +6,7 @@ def analyze_repo_development(repo_path: str = typer.Argument(..., help="Path to
6
6
  from machineconfig.scripts.python import count_lines
7
7
  from pathlib import Path
8
8
  count_lines_path = Path(count_lines.__file__)
9
- # --project $HOME/code/machineconfig
9
+ # --project $HOME/code/machineconfig --group plot
10
10
  cmd = f"""uv run --python 3.13 --with machineconfig[plot] {count_lines_path} analyze-over-time {repo_path}"""
11
11
  from machineconfig.utils.code import run_shell_script
12
12
  run_shell_script(cmd)
@@ -4,102 +4,131 @@ import machineconfig.utils.installer_utils.installer as installer_entry_point
4
4
  import machineconfig.scripts.python.share_terminal as share_terminal
5
5
  import machineconfig.scripts.python.repos as repos
6
6
 
7
- from machineconfig.utils.installer import get_machineconfig_version
7
+ import machineconfig.profile.create_frontend as create_frontend
8
+ # import machineconfig.scripts.python.dotfile as dotfile_module
8
9
  import typer
10
+ from typing import Literal, Annotated
9
11
 
10
12
 
11
- app = typer.Typer(help=f"🛠️ DevOps operations @ machineconfig {get_machineconfig_version()}", no_args_is_help=True)
13
+ app = typer.Typer(help="🛠️ DevOps operations", no_args_is_help=True)
12
14
  app.command(name="install", help="📦 Install essential packages")(installer_entry_point.main)
13
- app.command(name="share-terminal", help="📡 Share terminal via web browser")(share_terminal.main)
14
15
  app.add_typer(repos.app, name="repos", help="📁 Manage git repositories")
15
16
 
16
- ssh_app = typer.Typer(help="🔐 SSH operations subcommands", no_args_is_help=True)
17
- app.add_typer(ssh_app, name="ssh")
18
17
 
18
+ config_apps = typer.Typer(help="⚙️ Configuration subcommands", no_args_is_help=True)
19
+ app.add_typer(config_apps, name="config")
19
20
 
20
- @app.command()
21
+
22
+
23
+ app_data = typer.Typer(help="💾 Data subcommands", no_args_is_help=True)
24
+ app.add_typer(app_data, name="data")
25
+
26
+ nw_apps = typer.Typer(help="🔐 Network subcommands", no_args_is_help=True)
27
+ nw_apps.command(name="share-terminal", help="📡 Share terminal via web browser")(share_terminal.main)
28
+ app.add_typer(nw_apps, name="network")
29
+
30
+
31
+ self_app = typer.Typer(help="🔄 SELF operations subcommands", no_args_is_help=True)
32
+ app.add_typer(self_app, name="self")
33
+
34
+
35
+ @self_app.command()
21
36
  def update():
22
37
  """🔄 UPDATE essential repos"""
23
38
  import machineconfig.scripts.python.devops_update_repos as helper
24
39
  helper.main()
40
+ @self_app.command()
41
+ def interactive():
42
+ """🤖 INTERACTIVE configuration of machine."""
43
+ from machineconfig.scripts.python.interactive import main
44
+ main()
45
+ @self_app.command()
46
+ def status():
47
+ """📊 STATUS of machine, shell profile, apps, symlinks, dotfiles, etc."""
48
+ pass
25
49
 
26
50
 
27
- @app.command()
28
- def symlinks():
29
- """🔗 SYMLINKS of dotfiles."""
30
- import machineconfig.profile.create as helper
31
- helper.main_symlinks()
51
+ @config_apps.command(no_args_is_help=True)
52
+ def private():
53
+ """🔗 Manage private configuration files."""
54
+ create_frontend.main_private_from_parser()
32
55
 
56
+ @config_apps.command(no_args_is_help=True)
57
+ def public():
58
+ """🔗 Manage public configuration files."""
59
+ create_frontend.main_public_from_parser()
33
60
 
34
- @app.command()
35
- def profile():
36
- """🔗 Update shell profile."""
37
- import machineconfig.profile.create as helper
38
- helper.main_profile()
61
+ # @config_apps.command(no_args_is_help=True)
62
+ # def dotfile():
63
+ # """🔗 Manage dotfiles."""
64
+ # dotfile_module.main()
39
65
 
40
66
 
41
- @app.command()
42
- def symlinks_new():
43
- """🆕 SYMLINKS new"""
44
- import machineconfig.jobs.python.python_ve_symlink as helper
45
- helper.main()
67
+ @config_apps.command(no_args_is_help=True)
68
+ def shell(method: Annotated[Literal["copy", "reference"], typer.Argument(help="Choose the method to configure the shell profile: 'copy' copies the init script directly, 'reference' references machineconfig for dynamic updates.")]):
69
+ """🔗 Configure your shell profile."""
70
+ from machineconfig.profile.shell import create_default_shell_profile
71
+ create_default_shell_profile(method=method)
46
72
 
47
73
 
48
- @ssh_app.command()
74
+ @nw_apps.command()
49
75
  def add_key():
50
76
  """🔑 SSH add pub key to this machine"""
51
77
  import machineconfig.scripts.python.devops_add_ssh_key as helper
52
78
  helper.main()
53
- @ssh_app.command()
79
+ @nw_apps.command()
54
80
  def add_identity():
55
81
  """🗝️ SSH add identity (private key) to this machine"""
56
82
  import machineconfig.scripts.python.devops_add_identity as helper
57
83
  helper.main()
58
- @ssh_app.command()
84
+ @nw_apps.command()
59
85
  def connect():
60
86
  """🔐 SSH use key pair to connect two machines"""
61
87
  raise NotImplementedError
62
- @ssh_app.command()
88
+
89
+ @nw_apps.command()
63
90
  def setup():
64
91
  """📡 SSH setup"""
65
- _program_windows = """Invoke-WebRequest https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/openssh_all.ps1 | Invoke-Expression # https://github.com/thisismygitrepo.keys"""
66
- _program_linux = """curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/openssh_all.sh | sudo bash # https://github.com/thisismygitrepo.keys"""
67
- import subprocess
68
- from platform import system
69
- subprocess.run(_program_linux if system() == "Linux" else _program_windows, shell=True, check=True)
70
- @ssh_app.command()
71
- def setup_wsl():
72
- """🐧 SSH setup wsl"""
73
- import subprocess
74
- subprocess.run("curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/openssh_wsl.sh | sudo bash", shell=True, check=True)
75
-
76
-
77
- @app.command()
92
+ import platform
93
+ if platform.system() == "Windows":
94
+ from machineconfig.setup_windows import SSH_SERVER
95
+ program = SSH_SERVER.read_text(encoding="utf-8")
96
+ elif platform.system() == "Linux" or platform.system() == "Darwin":
97
+ from machineconfig.setup_linux import SSH_SERVER
98
+ program = SSH_SERVER.read_text(encoding="utf-8")
99
+ else:
100
+ raise NotImplementedError(f"Platform {platform.system()} is not supported.")
101
+ from machineconfig.utils.code import run_shell_script
102
+ run_shell_script(program=program)
103
+
104
+
105
+ @app_data.command()
78
106
  def backup():
79
107
  """💾 BACKUP"""
80
108
  from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve
81
109
  main_backup_retrieve(direction="BACKUP")
82
110
 
83
111
 
84
- @app.command()
112
+ @app_data.command()
85
113
  def retrieve():
86
114
  """📥 RETRIEVE"""
87
115
  from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve
88
116
  main_backup_retrieve(direction="RETRIEVE")
89
117
 
90
118
 
91
- @app.command()
92
- def scheduler():
93
- """⏰ SCHEDULER"""
94
- # from machineconfig.scripts.python.scheduler import main as helper
95
- # helper()
119
+ # @app.command()
120
+ # def scheduler():
121
+ # """⏰ SCHEDULER"""
122
+ # # from machineconfig.scripts.python.scheduler import main as helper
123
+ # # helper()
124
+
96
125
 
97
- @app.command()
98
- def interactive():
99
- """🤖 INTERACTIVE configuration of machine."""
100
- from machineconfig.scripts.python.interactive import main
101
- main()
102
126
 
127
+ # @app.command()
128
+ # def scheduler():
129
+ # """⏰ SCHEDULER"""
130
+ # # from machineconfig.scripts.python.scheduler import main as helper
131
+ # # helper()
103
132
 
104
133
 
105
134
  if __name__ == "__main__":
@@ -3,15 +3,13 @@
3
3
  from typing import Annotated
4
4
 
5
5
  import typer
6
- from rich.console import Console
7
- from rich.panel import Panel
8
6
 
9
- from machineconfig.utils.links import symlink_func
10
- from machineconfig.utils.path_extended import PathExtended
11
- from machineconfig.utils.source_of_truth import LIBRARY_ROOT, REPO_ROOT
12
7
 
13
-
14
- console = Console()
8
+ # @app.command()
9
+ # def symlinks_new():
10
+ # """🆕 SYMLINKS new. consider moving to the new config command, then may be merge it with the dotfile subcommand"""
11
+ # import machineconfig.jobs.python.python_ve_symlink as helper
12
+ # helper.main()
15
13
 
16
14
 
17
15
  def main(
@@ -19,6 +17,14 @@ def main(
19
17
  overwrite: Annotated[bool, typer.Option("--overwrite", "-o", help="Overwrite.")] = False,
20
18
  dest: Annotated[str, typer.Option("--dest", "-d", help="destination folder")] = "",
21
19
  ) -> None:
20
+
21
+ from rich.console import Console
22
+ from rich.panel import Panel
23
+
24
+ from machineconfig.utils.links import symlink_map
25
+ from machineconfig.utils.path_extended import PathExtended
26
+ from machineconfig.utils.source_of_truth import LIBRARY_ROOT, REPO_ROOT
27
+ console = Console()
22
28
  orig_path = PathExtended(file).expanduser().absolute()
23
29
  if dest == "":
24
30
  if "Local" in str(orig_path):
@@ -35,7 +41,7 @@ def main(
35
41
  dest_path.mkdir(parents=True, exist_ok=True)
36
42
  new_path = dest_path.joinpath(orig_path.name)
37
43
 
38
- symlink_func(this=orig_path, to_this=new_path, prioritize_to_this=overwrite)
44
+ symlink_map(config_file_default_path=orig_path, self_managed_config_file_path=new_path, on_conflict="throwError")
39
45
 
40
46
  console.print(
41
47
  Panel(
@@ -76,7 +76,6 @@ def get_installation_choices() -> list[str]:
76
76
  Choice(value="install_repos", title="🐍 Install Repos - Set up Python environment and repositories permanently.", checked=False),
77
77
  Choice(value="install_ssh_server", title="🔒 Install SSH Server - Set up remote access", checked=False),
78
78
  Choice(value="install_shell_profile", title="🐚 Configure Shell Profile - Source machineconfig shell initialization", checked=False),
79
- Choice(value="create_symlinks", title="🔗 Create Symlinks - Set up configuration symlinks (finish dotfiles transfer first)", checked=False),
80
79
  Choice(value="retrieve_repositories", title="📚 Retrieve Repositories - Clone repositories to ~/code", checked=False),
81
80
  Choice(value="retrieve_data", title="💾 Retrieve Data - Backup restoration", checked=False),
82
81
  ]
@@ -142,30 +141,12 @@ Set-Service -Name sshd -StartupType 'Automatic'"""
142
141
  console.print(Panel("🐚 [bold green]SHELL PROFILE[/bold green]\n[italic]Shell configuration setup[/italic]", border_style="green"))
143
142
  console.print("🔧 Configuring shell profile", style="bold cyan")
144
143
  try:
145
- from machineconfig.profile.create import main_profile
146
-
147
- main_profile()
144
+ from machineconfig.profile.shell import create_default_shell_profile
145
+ create_default_shell_profile()
148
146
  console.print("✅ Shell profile configured successfully", style="bold green")
149
147
  except Exception as e:
150
148
  console.print(f"❌ Error configuring shell profile: {e}", style="bold red")
151
149
 
152
- if "create_symlinks" in selected_options:
153
- display_dotfiles_instructions()
154
- dotfiles_ready = questionary.confirm("📂 Have you finished copying dotfiles?", default=True).ask()
155
- if dotfiles_ready:
156
- console.print(Panel("🔗 [bold cyan]SYMLINK CREATION[/bold cyan]\n[italic]Configuration setup[/italic]", border_style="cyan"))
157
- console.print("🔧 Creating symlinks", style="bold cyan")
158
- try:
159
- from machineconfig.profile.create import main_symlinks
160
- main_symlinks()
161
- console.print("✅ Symlinks created successfully", style="bold green")
162
- except Exception as e:
163
- console.print(f"❌ Error creating symlinks: {e}", style="bold red")
164
- run_shell_script("sudo chmod 600 $HOME/.ssh/*")
165
- run_shell_script("sudo chmod 700 $HOME/.ssh")
166
- else:
167
- console.print("⏭️ Skipping symlink creation - finish dotfiles transfer first", style="yellow")
168
-
169
150
  if "retrieve_repositories" in selected_options:
170
151
  console.print(Panel("📚 [bold bright_magenta]REPOSITORIES[/bold bright_magenta]\n[italic]Project code retrieval[/italic]", border_style="bright_magenta"))
171
152
  from machineconfig.scripts.python import repos
@@ -200,6 +181,7 @@ def main() -> None:
200
181
  console.print("❌ Installation cancelled.", style="bold red")
201
182
  sys.exit(0)
202
183
  execute_installations(selected_options)
184
+ display_dotfiles_instructions()
203
185
  display_completion_message()
204
186
 
205
187
 
@@ -133,7 +133,7 @@ def main(
133
133
  ttyd --writable -t enableSixel=true {ssl_args} --port {port} --credential "{username}:{password}" -t 'theme={{"background": "black"}}' {start_command}
134
134
  """
135
135
  from machineconfig.utils.code import run_shell_script
136
- run_shell_script(code)
136
+ run_shell_script(code, display_script=False)
137
137
 
138
138
 
139
139
  def main_with_parser():
@@ -0,0 +1,11 @@
1
+
2
+ from pathlib import Path
3
+
4
+ APPS = Path(__file__).parent.joinpath("apps.sh")
5
+ REPOS = Path(__file__).parent.joinpath("repos.sh")
6
+ VE = Path(__file__).parent.joinpath("ve.sh")
7
+
8
+ APPS_DESKTOP = Path(__file__).parent.joinpath("apps_desktop.sh")
9
+ APPS_GUI = Path(__file__).parent.joinpath("apps_gui.sh")
10
+
11
+ SSH_SERVER = Path(__file__).parent.joinpath("ssh/openssh_server.sh")
@@ -13,6 +13,7 @@ sudo chmod 700 ~/.ssh
13
13
  echo "✅ FINISHED modifying .ssh folder attributes."
14
14
 
15
15
  # 🔄 Clean install OpenSSH server
16
+ sudo nala install openssh-server -y || true # try to install first
16
17
  sudo nala purge openssh-server -y
17
18
  sudo nala install openssh-server -y
18
19
  echo "✅ FINISHED installing openssh-server."
@@ -6,4 +6,4 @@ echo """
6
6
  ======================================================================="""
7
7
 
8
8
  curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/ve.sh | bash
9
- $HOME/.local/bin/uv run --python 3.13 --with machineconfig devops interactive
9
+ $HOME/.local/bin/uv run --python 3.13 --with machineconfig devops self interactive
@@ -0,0 +1,12 @@
1
+
2
+ from pathlib import Path
3
+
4
+ APPS = Path(__file__).parent.joinpath("apps.ps1")
5
+ REPOS = Path(__file__).parent.joinpath("repos.ps1")
6
+ VE = Path(__file__).parent.joinpath("ve.ps1")
7
+
8
+ DOCKER = Path(__file__).parent.joinpath("others/docker.ps1")
9
+ OBS = Path(__file__).parent.joinpath("others/obs.ps1")
10
+ POWER_OPTIONS = Path(__file__).parent.joinpath("others/power_options.ps1")
11
+
12
+ SSH_SERVER = Path(__file__).parent.joinpath("ssh/openssh_server.ps1")
@@ -12,6 +12,7 @@ winget install --no-upgrade --name "Starship" --Id "Starship
12
12
  winget install --no-upgrade --name "Git" --Id "Git.Git" --source winget --scope user --accept-package-agreements --accept-source-agreements
13
13
  winget install --no-upgrade --name "Neovim" --Id "Neovim.Neovim" --source winget --scope user --accept-package-agreements --accept-source-agreements
14
14
  winget install --no-upgrade --name "GNU Nano" --Id "GNU.Nano" --source winget --scope user --accept-package-agreements --accept-source-agreements
15
+ winget install --no-upgrade --Id CoreyButler.NVMforWindows --source winget --scope user --accept-package-agreements --accept-source-agreements
15
16
  Install-Module -Name Terminal-Icons -Repository PSGallery -Force -AcceptLicense -PassThru -Confirm # -RequiredVersion 2.5.10
16
17
  Install-Module -Name PSFzf -SkipPublisherCheck # -AcceptLicense -PassThru -Confirm # -RequiredVersion 2.5.10
17
18
 
@@ -9,12 +9,12 @@ if (!$pubkey_string) {
9
9
  Write-Output "pubkey_string is already defined."
10
10
  }
11
11
 
12
- cd ~
13
- echo $null >> .ssh/authorized_keys # powershell way of touching a file if it doesn't exist
14
- echo $pubkey_string >> .ssh/authorized_keys
15
- echo $pubkey_string > .ssh/pubkey.pub
16
- Invoke-WebRequest https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/openssh-server_add-sshkey.ps1 | Invoke-Expression
17
12
 
13
+ echo $null >> $HOME/.ssh/authorized_keys # powershell way of touching a file if it doesn't exist
14
+ echo $pubkey_string >> $HOME/.ssh/authorized_keys
15
+ echo $pubkey_string > $HOME/.ssh/pubkey.pub
16
+
17
+ Invoke-WebRequest https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/openssh-server_add-sshkey.ps1 | Invoke-Expression
18
18
  ipconfig.exe
19
19
 
20
20
  echo "Done"
@@ -9,5 +9,5 @@ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thisismygitrepo/machin
9
9
  .\ve.ps1
10
10
  rm ve.ps1
11
11
 
12
- uv run --python 3.13 --with machineconfig devops interactive
12
+ uv run --python 3.13 --with machineconfig devops self interactive
13
13
  # uv run --python 3.13 --with machineconfig https://raw.githubusercontent.com/thisismygitrepo/machineconfig/ee4f69e838e1acbb275bfb5a3d3faee23345f2a8/src/machineconfig/scripts/python/devops.py
@@ -98,7 +98,7 @@ def print_code(code: str, lexer: str, desc: str, subtitle: str = ""):
98
98
  console.print(Panel(Syntax(code=code, lexer=lexer), title=f"📄 {desc}", subtitle=subtitle), style="bold red")
99
99
 
100
100
 
101
- def run_shell_script(program: str):
101
+ def run_shell_script(program: str, display_script: bool = True):
102
102
  import tempfile
103
103
  if platform.system() == "Windows":
104
104
  suffix = ".ps1"
@@ -110,16 +110,19 @@ def run_shell_script(program: str):
110
110
  temp_file.write(program)
111
111
  temp_script_path = PathExtended(temp_file.name)
112
112
  console = Console()
113
- # console.print(f"📝 [blue]Temporary script written to:[/blue] [green]{temp_script_path}[/green]")
114
- from rich.syntax import Syntax
115
- console.print(Panel(Syntax(code=program, lexer=lexer), title=f"📄script @ {temp_script_path}", subtitle="shell code"), style="bold red")
113
+ if display_script:
114
+ from rich.syntax import Syntax
115
+ console.print(Panel(Syntax(code=program, lexer=lexer), title=f"📄 shell script @ {temp_script_path}", subtitle="shell script being executed"), style="bold red")
116
+
116
117
  if platform.system() == "Windows":
117
118
  import subprocess
118
119
  subprocess.run(f'powershell -ExecutionPolicy Bypass -File "{temp_script_path}"', check=True, shell=True)
119
120
  elif platform.system() == "Linux" or platform.system() == "Darwin":
120
121
  import subprocess
121
122
  subprocess.run(f"bash {str(temp_script_path)}", check=True, shell=True)
123
+
122
124
  temp_script_path.unlink(missing_ok=True)
125
+
123
126
  # def run_command(command: str, description: str) -> bool:
124
127
  # """Execute a shell command and return success status."""
125
128
  # console.print(f"\n🔧 {description}", style="bold cyan")