machineconfig 2.6__py3-none-any.whl → 2.7__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.
- machineconfig/cluster/remote/remote_machine.py +0 -1
- machineconfig/cluster/sessions_managers/wt_local.py +1 -1
- machineconfig/cluster/sessions_managers/wt_local_manager.py +1 -1
- machineconfig/cluster/sessions_managers/wt_remote.py +1 -1
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +1 -1
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +1 -1
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +1 -1
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_local.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_remote.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +1 -1
- machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python/vscode/sync_code.py +0 -1
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/profile/create.py +8 -16
- machineconfig/profile/shell.py +140 -179
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/linux/choose_wezterm_theme +1 -1
- machineconfig/scripts/linux/cloud_copy +1 -1
- machineconfig/scripts/linux/cloud_mount +1 -1
- machineconfig/scripts/linux/cloud_repo_sync +1 -1
- machineconfig/scripts/linux/cloud_sync +1 -1
- machineconfig/scripts/linux/croshell +2 -1
- machineconfig/scripts/linux/devops +1 -1
- machineconfig/scripts/linux/fire +1 -1
- machineconfig/scripts/linux/fire_agents +1 -1
- machineconfig/scripts/linux/ftpx +1 -1
- machineconfig/scripts/linux/gh_models +1 -1
- machineconfig/scripts/linux/kill_process +1 -1
- machineconfig/scripts/linux/mcinit +1 -1
- machineconfig/scripts/linux/mount_nfs +1 -1
- machineconfig/scripts/linux/mount_nw_drive +1 -11
- machineconfig/scripts/linux/repos +1 -1
- machineconfig/scripts/linux/scheduler +1 -1
- machineconfig/scripts/linux/start_slidev +1 -1
- machineconfig/scripts/linux/start_terminals +1 -1
- machineconfig/scripts/linux/wifi_conn +1 -1
- machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_repo_sync.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos_helper_record.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/mcinit.py +16 -2
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +1 -1
- machineconfig/scripts/python/croshell.py +0 -1
- machineconfig/scripts/python/devops.py +1 -13
- machineconfig/scripts/python/devops_update_repos.py +39 -19
- machineconfig/scripts/python/fire_agents.py +1 -1
- machineconfig/scripts/python/fire_jobs.py +8 -3
- machineconfig/scripts/python/fire_jobs_layout_helper.py +1 -1
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-313.pyc +0 -0
- machineconfig/scripts/python/repos.py +10 -227
- machineconfig/scripts/python/repos_helper_record.py +193 -0
- machineconfig/scripts/windows/choose_wezterm_theme.ps1 +1 -1
- machineconfig/scripts/windows/cloud_copy.ps1 +1 -1
- machineconfig/scripts/windows/cloud_mount.ps1 +1 -1
- machineconfig/scripts/windows/cloud_repo_sync.ps1 +1 -1
- machineconfig/scripts/windows/cloud_sync.ps1 +1 -1
- machineconfig/scripts/windows/croshell.ps1 +1 -1
- machineconfig/scripts/windows/devops.ps1 +1 -29
- machineconfig/scripts/windows/dotfile.ps1 +1 -1
- machineconfig/scripts/windows/fire.ps1 +1 -45
- machineconfig/scripts/windows/ftpx.ps1 +1 -1
- machineconfig/scripts/windows/gpt.ps1 +1 -23
- machineconfig/scripts/windows/kill_process.ps1 +1 -1
- machineconfig/scripts/windows/mcinit.ps1 +1 -1
- machineconfig/scripts/windows/mount_ssh.ps1 +1 -1
- machineconfig/scripts/windows/pomodoro.ps1 +1 -1
- machineconfig/scripts/windows/repos.ps1 +1 -1
- machineconfig/scripts/windows/scheduler.ps1 +1 -1
- machineconfig/scripts/windows/snapshot.ps1 +1 -1
- machineconfig/scripts/windows/start_slidev.ps1 +1 -1
- machineconfig/scripts/windows/start_terminals.ps1 +1 -1
- machineconfig/scripts/windows/wifi_conn.ps1 +1 -2
- machineconfig/settings/shells/pwsh/init.ps1 +0 -4
- machineconfig/setup_linux/web_shortcuts/croshell.sh +1 -1
- machineconfig/setup_linux/web_shortcuts/interactive.sh +7 -13
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +9 -18
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +1 -66
- machineconfig/utils/links.py +1 -2
- machineconfig/utils/options.py +8 -5
- machineconfig/utils/procs.py +5 -1
- machineconfig/utils/scheduling.py +0 -1
- machineconfig/{cluster/sessions_managers → utils/schemas/layouts}/layout_types.py +0 -1
- machineconfig/utils/schemas/repos/repos_types.py +28 -0
- machineconfig/utils/source_of_truth.py +1 -4
- machineconfig/utils/ssh.py +1 -1
- {machineconfig-2.6.dist-info → machineconfig-2.7.dist-info}/METADATA +1 -1
- {machineconfig-2.6.dist-info → machineconfig-2.7.dist-info}/RECORD +103 -110
- {machineconfig-2.6.dist-info → machineconfig-2.7.dist-info}/entry_points.txt +1 -1
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/profile/create_hardlinks.py +0 -140
- machineconfig/scripts/linux/checkout_versions +0 -2
- machineconfig/scripts/linux/cloud_manager +0 -2
- machineconfig/scripts/linux/url2md +0 -2
- machineconfig/scripts/python/__pycache__/croshell.cpython-313.pyc +0 -0
- machineconfig/scripts/windows/checkout_version.ps1 +0 -1
- machineconfig/scripts/windows/cloud_manager.ps1 +0 -1
- machineconfig/scripts/windows/neofetch.ps1 +0 -2
- machineconfig/scripts/windows/wsl_windows_transfer.ps1 +0 -1
- machineconfig/settings/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/settings/shells/ipy/profiles/default/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/settings/shells/ipy/profiles/default/startup/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/utils/ai/browser_user_wrapper.py +0 -66
- machineconfig/utils/ai/url2md.py +0 -85
- /machineconfig/setup_windows/wt_and_pwsh/{set_pwsh_theme.py → install_nerd_fonts.py} +0 -0
- {machineconfig-2.6.dist-info → machineconfig-2.7.dist-info}/WHEEL +0 -0
- {machineconfig-2.6.dist-info → machineconfig-2.7.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
# PATH extension =====================================================
|
|
5
|
-
# $env:Path += ";$HOME\code\machineconfig\src\machineconfig\scripts\windows;$HOME\dotfiles\scripts\windows;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files\CodeBlocks\MinGW\bin;C:\Program Files\nu\bin;C:\Program Files\Graphviz\bin"
|
|
6
|
-
|
|
7
3
|
function Add-ToPathIfNotAlready {
|
|
8
4
|
param (
|
|
9
5
|
[Parameter(Mandatory=$true)]
|
|
@@ -7,5 +7,5 @@ cd $HOME/code/machineconfig
|
|
|
7
7
|
$HOME/.local/bin/uv sync --no-dev
|
|
8
8
|
$HOME/.local/bin/uv pip install -e ../crocodile
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
uv run --no-dev --project $HOME/code/machineconfig -m fire machineconfig.profile.create main --choice=all
|
|
11
11
|
. ~/.bashrc
|
|
@@ -37,8 +37,7 @@ echo """#=======================================================================
|
|
|
37
37
|
🐍 PYTHON ENVIRONMENT | Virtual environment setup
|
|
38
38
|
#=======================================================================
|
|
39
39
|
"""
|
|
40
|
-
read -p "🐍 Install
|
|
41
|
-
export ve_name=".venv"
|
|
40
|
+
read -p "🐍 Install UV and repos [y]/n? " choice
|
|
42
41
|
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
|
|
43
42
|
echo """ 🔧 Setting up Python environment...
|
|
44
43
|
"""
|
|
@@ -102,8 +101,7 @@ choice=${choice:-y}
|
|
|
102
101
|
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
|
|
103
102
|
echo """ 🔧 Creating symlinks and setting permissions...
|
|
104
103
|
"""
|
|
105
|
-
|
|
106
|
-
python -m fire machineconfig.profile.create main --choice=all
|
|
104
|
+
uv run --python 3.13 --with machineconfig python -m fire machineconfig.profile.create main --choice=all
|
|
107
105
|
sudo chmod 600 $HOME/.ssh/*
|
|
108
106
|
sudo chmod 700 $HOME/.ssh
|
|
109
107
|
else
|
|
@@ -120,8 +118,7 @@ choice=${choice:-y}
|
|
|
120
118
|
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
|
|
121
119
|
echo """ 🔧 Installing CLI applications...
|
|
122
120
|
"""
|
|
123
|
-
.
|
|
124
|
-
python -m fire machineconfig.scripts.python.devops_devapps_install main --which=AllEssentials
|
|
121
|
+
uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_devapps_install main --which=AllEssentials
|
|
125
122
|
. $HOME/.bashrc
|
|
126
123
|
else
|
|
127
124
|
echo """ ⏭️ Skipping CLI apps installation
|
|
@@ -132,16 +129,14 @@ echo """#=======================================================================
|
|
|
132
129
|
🛠️ DEVELOPMENT TOOLS | Software development packages
|
|
133
130
|
#=======================================================================
|
|
134
131
|
"""
|
|
135
|
-
read -p "🛠️ Install Development Tools [y]/n? " choice
|
|
132
|
+
read -p "🛠️ Install Development Tools (rust, libssql-dev, ffmpeg, wezterm, brave, code) [y]/n? " choice
|
|
136
133
|
choice=${choice:-y}
|
|
137
134
|
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
|
|
138
|
-
echo """ 🔧 Installing development tools...
|
|
139
|
-
"""
|
|
135
|
+
echo """ 🔧 Installing development tools... """
|
|
140
136
|
(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh) || true
|
|
141
137
|
sudo nala install libssl-dev -y
|
|
142
138
|
sudo nala install ffmpeg -y
|
|
143
|
-
.
|
|
144
|
-
python -m fire machineconfig.scripts.python.devops_devapps_install main --which=wezterm,brave,code
|
|
139
|
+
uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_devapps_install main --which=wezterm,brave,code
|
|
145
140
|
else
|
|
146
141
|
echo """ ⏭️ Skipping development tools installation
|
|
147
142
|
"""
|
|
@@ -171,8 +166,7 @@ choice=${choice:-y}
|
|
|
171
166
|
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
|
|
172
167
|
echo """ 🔄 Retrieving data...
|
|
173
168
|
"""
|
|
174
|
-
.
|
|
175
|
-
python -m fire machineconfig.scripts.python.devops_backup_retrieve main --direction=RETRIEVE
|
|
169
|
+
uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_backup_retrieve main --direction=RETRIEVE
|
|
176
170
|
else
|
|
177
171
|
echo """ ⏭️ Skipping data retrieval
|
|
178
172
|
"""
|
|
@@ -7,16 +7,16 @@ Write-Host "ℹ️ If you have execution policy issues, run:
|
|
|
7
7
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser"
|
|
8
8
|
Write-Host "💡 To accept all prompts automatically, run: `$yesAll = `$true`n"
|
|
9
9
|
|
|
10
|
-
# Set environment variable and execute scripts
|
|
11
|
-
$ve_name = ".venv"
|
|
12
10
|
|
|
13
11
|
Write-Host "🔄 Setting up Python environment..."
|
|
14
12
|
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/ve.ps1" -OutFile "ve.ps1"
|
|
15
13
|
.\ve.ps1
|
|
14
|
+
rm ve.ps1
|
|
16
15
|
|
|
17
16
|
Write-Host "`n🔄 Setting up repositories..."
|
|
18
17
|
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/repos.ps1" -OutFile "repos.ps1"
|
|
19
18
|
.\repos.ps1
|
|
19
|
+
rm repos.ps1
|
|
20
20
|
|
|
21
21
|
Write-Host "`n📂 ============================================
|
|
22
22
|
🔄 DOTFILES MIGRATION OPTIONS
|
|
@@ -97,7 +97,8 @@ if ($createLinksChoice -eq "y" -or $createLinksChoice -eq "Y") {
|
|
|
97
97
|
if ($linkTypeChoice -eq "s" -or $linkTypeChoice -eq "S") {
|
|
98
98
|
python -m fire machineconfig.profile.create main --choice=all
|
|
99
99
|
} elseif ($linkTypeChoice -eq "h" -or $linkTypeChoice -eq "H") {
|
|
100
|
-
python -m fire machineconfig.profile.create_hardlinks main --choice=all
|
|
100
|
+
# python -m fire machineconfig.profile.create_hardlinks main --choice=all
|
|
101
|
+
python -m fire machineconfig.profile.create main --choice=all
|
|
101
102
|
} else {
|
|
102
103
|
Write-Host "Invalid choice for link type. Installation aborted."
|
|
103
104
|
}
|
|
@@ -119,9 +120,7 @@ if (-not $yesAll) {
|
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
} else {
|
|
122
|
-
.
|
|
123
|
-
python -m fire machineconfig.scripts.python.devops_devapps_install main --which=AllEssentials
|
|
124
|
-
deactivate
|
|
123
|
+
uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_devapps_install main --which=AllEssentials
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
|
|
@@ -146,8 +145,7 @@ if (-not $yesAll) {
|
|
|
146
145
|
}
|
|
147
146
|
if ([string]::IsNullOrEmpty($choice)) { $choice = "y" }
|
|
148
147
|
if ($choice -eq "y" -or $choice -eq "Y") {
|
|
149
|
-
.
|
|
150
|
-
python -m fire machineconfig.scripts.python.devops_backup_retrieve main --direction=RETRIEVE
|
|
148
|
+
uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_backup_retrieve main --direction=RETRIEVE
|
|
151
149
|
} else {
|
|
152
150
|
Write-Host "Installation aborted."
|
|
153
151
|
}
|
|
@@ -161,19 +159,12 @@ if (-not $yesAll) {
|
|
|
161
159
|
}
|
|
162
160
|
if ([string]::IsNullOrEmpty($choice)) { $choice = "y" }
|
|
163
161
|
if ($choice -eq "y" -or $choice -eq "Y") {
|
|
164
|
-
# python -m fire machineconfig.scripts.python.devops_devapps_install main --which=wezterm
|
|
165
|
-
# python -m fire machineconfig.scripts.python.devops_devapps_install main --which=brave
|
|
166
|
-
# python -m fire machineconfig.scripts.python.devops_devapps_install main --which=code
|
|
167
162
|
winget install --no-upgrade --name "Windows Terminal" --Id "Microsoft.WindowsTerminal" --source winget --scope user --accept-package-agreements --accept-source-agreements # Terminal is is installed by default on W 11
|
|
168
163
|
winget install --no-upgrade --name "Powershell" --Id "Microsoft.PowerShell" --source winget --scope user --accept-package-agreements --accept-source-agreements # powershell require admin
|
|
169
|
-
python -m fire machineconfig.setup_windows.wt_and_pwsh.set_pwsh_theme install_nerd_fonts
|
|
170
|
-
python -m fire machineconfig.setup_windows.wt_and_pwsh.set_wt_settings main
|
|
171
164
|
winget install --no-upgrade --name "Brave" --Id "Brave.Brave" --source winget --scope user --accept-package-agreements --accept-source-agreements
|
|
172
165
|
winget install --no-upgrade --name "Microsoft Visual Studio Code" --Id "Microsoft.VisualStudioCode" --source winget --scope user --accept-package-agreements --accept-source-agreements
|
|
173
|
-
.
|
|
174
|
-
python -m fire machineconfig.setup_windows.wt_and_pwsh.
|
|
175
|
-
python -m fire machineconfig.setup_windows.wt_and_pwsh.set_wt_settings main
|
|
176
|
-
|
|
166
|
+
uv run --python 3.13 --with machineconfig python -m fire machineconfig.setup_windows.wt_and_pwsh.install_nerd_fonts main
|
|
167
|
+
uv run --python 3.13 --with machineconfig python -m fire machineconfig.setup_windows.wt_and_pwsh.set_wt_settings main
|
|
177
168
|
} else {
|
|
178
169
|
Write-Host "Installation aborted."
|
|
179
170
|
}
|
|
@@ -181,7 +172,7 @@ if ($choice -eq "y" -or $choice -eq "Y") {
|
|
|
181
172
|
|
|
182
173
|
# Install Apps
|
|
183
174
|
if (-not $yesAll) {
|
|
184
|
-
$choice = Read-Host "Install Apps [y]/n ? "
|
|
175
|
+
$choice = Read-Host "Install Windows Apps [y]/n ? "
|
|
185
176
|
} else {
|
|
186
177
|
$choice = "y"
|
|
187
178
|
}
|
|
@@ -4,8 +4,7 @@ from machineconfig.utils.utils2 import randstr, read_json
|
|
|
4
4
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
5
5
|
from machineconfig.utils.io_save import save_json
|
|
6
6
|
import platform
|
|
7
|
-
from
|
|
8
|
-
from uuid import uuid4
|
|
7
|
+
# from uuid import uuid4
|
|
9
8
|
import os
|
|
10
9
|
from typing import Any
|
|
11
10
|
from rich.console import Console
|
|
@@ -100,65 +99,6 @@ class TerminalSettings(object):
|
|
|
100
99
|
else:
|
|
101
100
|
console.print(Panel("❌ PowerShell profile was not found in the list of profiles and therefore was not made the default.", title="[bold red]Terminal Settings[/bold red]", border_style="red"))
|
|
102
101
|
|
|
103
|
-
def add_croshell(self):
|
|
104
|
-
print("\n🐊 Adding croshell profile...")
|
|
105
|
-
croshell = dict(
|
|
106
|
-
name="croshell",
|
|
107
|
-
guid="{" + str(uuid4()) + "}",
|
|
108
|
-
commandline=f'powershell.exe -Command "{LIBRARY_ROOT.as_posix()}/scripts/windows/croshell.ps1"',
|
|
109
|
-
startingDirectory="%USERPROFILE%", # "%USERPROFILE%", # None: inherent from parent process.
|
|
110
|
-
)
|
|
111
|
-
# startingDirectory = None means: inheret from parent process, which will is the default, which point to /System32
|
|
112
|
-
# Launching a new profile with ctr+shift+2 is equivalent to: wt --profile croshell -d . --new-tab
|
|
113
|
-
for profile in self.profs:
|
|
114
|
-
if profile["name"] == "croshell":
|
|
115
|
-
profile.update(croshell)
|
|
116
|
-
console.print(Panel("✅ Updated existing croshell profile", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
|
|
117
|
-
break
|
|
118
|
-
else:
|
|
119
|
-
self.profs.append(croshell)
|
|
120
|
-
console.print(Panel("✅ Added new croshell profile", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
|
|
121
|
-
|
|
122
|
-
def add_ubuntu(self):
|
|
123
|
-
print("\n🐧 Adding Ubuntu WSL profile...")
|
|
124
|
-
# Add Ubunto if it is not there.
|
|
125
|
-
ubuntu = dict(
|
|
126
|
-
name="Ubuntu",
|
|
127
|
-
commandline="wsl -d Ubuntu -- cd ~",
|
|
128
|
-
hidden=False,
|
|
129
|
-
guid="{" + str(uuid4()) + "}",
|
|
130
|
-
startingDirectory="%USERPROFILE%", # "%USERPROFILE%", # None: inherent from parent process.
|
|
131
|
-
)
|
|
132
|
-
if not any(x.get("name") == "Ubuntu" for x in self.profs):
|
|
133
|
-
self.profs.append(ubuntu)
|
|
134
|
-
console.print(Panel("✅ Added Ubuntu WSL profile", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
|
|
135
|
-
else:
|
|
136
|
-
console.print(Panel("ℹ️ Ubuntu profile already exists", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
|
|
137
|
-
|
|
138
|
-
def standardize_profiles_order(self):
|
|
139
|
-
print("\n🔄 Standardizing profile order...")
|
|
140
|
-
# Changing order of profiles:
|
|
141
|
-
others = []
|
|
142
|
-
pwsh = croshell = ubuntu = wpwsh = cmd = azure = None
|
|
143
|
-
for profile in self.profs:
|
|
144
|
-
name = profile["name"]
|
|
145
|
-
if name == "PowerShell":
|
|
146
|
-
pwsh = profile
|
|
147
|
-
elif name == "croshell":
|
|
148
|
-
croshell = profile
|
|
149
|
-
elif name == "Ubuntu":
|
|
150
|
-
ubuntu = profile
|
|
151
|
-
elif name == "Windows PowerShell":
|
|
152
|
-
wpwsh = profile
|
|
153
|
-
elif name == "Command Prompt":
|
|
154
|
-
cmd = profile
|
|
155
|
-
elif name == "Azure Cloud Shell":
|
|
156
|
-
azure = profile
|
|
157
|
-
else:
|
|
158
|
-
others.append(profile)
|
|
159
|
-
self.profs = [item for item in [pwsh, croshell, ubuntu, wpwsh, cmd, azure] + others if item is not None]
|
|
160
|
-
console.print(Panel("✅ Profile order standardized", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
|
|
161
|
-
|
|
162
102
|
|
|
163
103
|
def main():
|
|
164
104
|
print(f"\n{'=' * 80}\n🖥️ WINDOWS TERMINAL SETUP 🖥️\n{'=' * 80}")
|
|
@@ -168,12 +108,7 @@ def main():
|
|
|
168
108
|
ts = TerminalSettings()
|
|
169
109
|
ts.update_default_settings()
|
|
170
110
|
ts.customize_powershell(nerd_font=True)
|
|
171
|
-
|
|
172
111
|
ts.make_powershell_default_profile()
|
|
173
|
-
ts.add_croshell()
|
|
174
|
-
ts.add_ubuntu()
|
|
175
|
-
ts.standardize_profiles_order()
|
|
176
|
-
|
|
177
112
|
print("⌨️ Adding keyboard shortcut for pane zoom (ctrl+shift+z)...")
|
|
178
113
|
ts.dat["actions"].append({"command": "togglePaneZoom", "keys": "ctrl+shift+z"})
|
|
179
114
|
|
machineconfig/utils/links.py
CHANGED
|
@@ -112,10 +112,9 @@ def symlink_func(this: PathExtended, to_this: PathExtended, prioritize_to_this:
|
|
|
112
112
|
console.print(Panel(f"❌ ERROR | Failed at linking {this} ➡️ {to_this}. Reason: {ex}", title="Error", expand=False))
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
def symlink_copy(this: PathExtended, to_this: PathExtended, prioritize_to_this: bool
|
|
115
|
+
def symlink_copy(this: PathExtended, to_this: PathExtended, prioritize_to_this: bool):
|
|
116
116
|
this = PathExtended(this).expanduser().absolute()
|
|
117
117
|
to_this = PathExtended(to_this).expanduser().absolute()
|
|
118
|
-
# Case analysis based on docstring of symlink_func
|
|
119
118
|
if this.exists():
|
|
120
119
|
if to_this.exists():
|
|
121
120
|
if this.is_symlink():
|
machineconfig/utils/options.py
CHANGED
|
@@ -14,22 +14,25 @@ T = TypeVar("T")
|
|
|
14
14
|
def check_tool_exists(tool_name: str) -> bool:
|
|
15
15
|
if platform.system() == "Windows":
|
|
16
16
|
tool_name = tool_name.replace(".exe", "") + ".exe"
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
res1 = any([Path(WINDOWS_INSTALL_PATH).joinpath(tool_name).is_file(), Path.home().joinpath("AppData/Roaming/npm").joinpath(tool_name).is_file()])
|
|
18
|
+
tool_name = tool_name.replace(".exe", "") + ".exe"
|
|
19
|
+
res2 = any([Path(WINDOWS_INSTALL_PATH).joinpath(tool_name).is_file(), Path.home().joinpath("AppData/Roaming/npm").joinpath(tool_name).is_file()])
|
|
20
|
+
return res1 or res2
|
|
19
21
|
elif platform.system() in ["Linux", "Darwin"]:
|
|
20
|
-
cmd = "which"
|
|
21
22
|
root_path = Path(LINUX_INSTALL_PATH)
|
|
22
23
|
return any([Path("/usr/local/bin").joinpath(tool_name).is_file(), Path("/usr/bin").joinpath(tool_name).is_file(), root_path.joinpath(tool_name).is_file()])
|
|
23
24
|
else:
|
|
24
25
|
raise NotImplementedError(f"platform {platform.system()} not implemented")
|
|
25
|
-
_ = cmd
|
|
26
|
+
# _ = cmd
|
|
27
|
+
# cmd = "where.exe"
|
|
28
|
+
# cmd = "which"
|
|
26
29
|
# try: # talking to terminal is too slow.
|
|
27
30
|
# _tmp = subprocess.check_output([cmd, tool_name], stderr=subprocess.DEVNULL)
|
|
28
31
|
# res: bool = True
|
|
29
32
|
# except (subprocess.CalledProcessError, FileNotFoundError):
|
|
30
33
|
# res = False
|
|
31
34
|
# return res
|
|
32
|
-
return root_path.joinpath(tool_name).is_file()
|
|
35
|
+
# return root_path.joinpath(tool_name).is_file()
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
def choose_one_option(options: Iterable[T], header: str = "", tail: str = "", prompt: str = "", msg: str = "", default: Optional[T] = None, fzf: bool = False, custom_input: bool = False) -> T:
|
machineconfig/utils/procs.py
CHANGED
|
@@ -230,5 +230,9 @@ def get_age(create_time: Any) -> str:
|
|
|
230
230
|
return f"unknown due to {ee} and {e}"
|
|
231
231
|
|
|
232
232
|
|
|
233
|
+
def main():
|
|
234
|
+
from machineconfig.utils.procs import ProcessManager; ProcessManager().choose_and_kill()
|
|
235
|
+
|
|
236
|
+
|
|
233
237
|
if __name__ == "__main__":
|
|
234
|
-
|
|
238
|
+
main()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from typing import TypedDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class GitVersionInfo(TypedDict):
|
|
8
|
+
branch: str
|
|
9
|
+
commit: str
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RepoRemote(TypedDict):
|
|
13
|
+
name: str
|
|
14
|
+
url: str
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class RepoRecordDict(TypedDict):
|
|
18
|
+
name: str
|
|
19
|
+
parentDir: str
|
|
20
|
+
currentBranch: str
|
|
21
|
+
remotes: list[RepoRemote]
|
|
22
|
+
version: GitVersionInfo
|
|
23
|
+
isDirty: bool
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class RepoRecordFile(TypedDict):
|
|
27
|
+
version: str
|
|
28
|
+
repos: list[RepoRecordDict]
|
|
@@ -3,12 +3,11 @@ Utils
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
import machineconfig
|
|
6
|
-
# import platform
|
|
7
6
|
from pathlib import Path
|
|
8
7
|
|
|
9
8
|
LIBRARY_ROOT = Path(machineconfig.__file__).resolve().parent
|
|
10
9
|
REPO_ROOT = LIBRARY_ROOT.parent.parent
|
|
11
|
-
|
|
10
|
+
|
|
12
11
|
CONFIG_PATH = Path.home().joinpath(".config/machineconfig")
|
|
13
12
|
DEFAULTS_PATH = Path.home().joinpath("dotfiles/machineconfig/defaults.ini")
|
|
14
13
|
|
|
@@ -22,6 +21,4 @@ WINDOWS_INSTALL_PATH = Path.home().joinpath("AppData/Local/Microsoft/WindowsApps
|
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
if __name__ == "__main__":
|
|
25
|
-
# import typer
|
|
26
|
-
# typer.run(check_tool_exists)
|
|
27
24
|
pass
|
machineconfig/utils/ssh.py
CHANGED
|
@@ -201,7 +201,7 @@ class SSH: # inferior alternative: https://github.com/fabric/fabric
|
|
|
201
201
|
assert '"' not in cmd, 'Avoid using `"` in your command. I dont know how to handle this when passing is as command to python in pwsh command.'
|
|
202
202
|
if not return_obj:
|
|
203
203
|
return self.run(
|
|
204
|
-
cmd=f"""uv run --
|
|
204
|
+
cmd=f"""uv run --no-dev --project $HOME/code/machineconfig -c "{Terminal.get_header(wdir=None, toolbox=True)}{cmd}\n""" + '"', desc=desc or f"run_py on {self.get_remote_repr()}", verbose=verbose, strict_err=strict_err, strict_returncode=strict_returncode
|
|
205
205
|
)
|
|
206
206
|
assert "obj=" in cmd, "The command sent to run_py must have `obj=` statement if return_obj is set to True"
|
|
207
207
|
source_file = self.run_py(f"""{cmd}\npath = Save.pickle(obj=obj, path=P.tmpfile(suffix='.pkl'))\nprint(path)""", desc=desc, verbose=verbose, strict_err=True, strict_returncode=True).op.split("\n")[-1]
|