machineconfig 7.37__py3-none-any.whl → 7.39__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/jobs/installer/installer_data.json +9 -9
- machineconfig/jobs/installer/package_groups.py +1 -0
- machineconfig/profile/create_links.py +2 -1
- machineconfig/profile/create_links_export.py +37 -8
- machineconfig/profile/create_shell_profile.py +64 -124
- machineconfig/scripts/linux/wrap_mcfg +1 -1
- machineconfig/scripts/python/croshell.py +4 -4
- machineconfig/scripts/python/define.py +1 -1
- machineconfig/scripts/python/env_manager/path_manager_tui.py +1 -1
- machineconfig/scripts/python/helpers_devops/cli_config.py +27 -32
- machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +12 -9
- machineconfig/scripts/python/helpers_devops/cli_repos.py +11 -10
- machineconfig/scripts/python/helpers_devops/cli_self.py +5 -7
- machineconfig/scripts/python/helpers_devops/cli_utils.py +10 -10
- machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py +34 -15
- machineconfig/scripts/python/helpers_repos/count_lines_frontend.py +1 -1
- machineconfig/scripts/python/machineconfig.py +7 -0
- machineconfig/scripts/python/terminal.py +20 -3
- machineconfig/scripts/python/utils.py +3 -3
- machineconfig/scripts/windows/mounts/mount_ssh.ps1 +1 -1
- machineconfig/scripts/windows/wrap_mcfg.ps1 +5 -0
- machineconfig/settings/shells/nushell/config.nu +1 -31
- machineconfig/settings/shells/nushell/init.nu +100 -34
- machineconfig/settings/shells/wt/settings.json +10 -2
- machineconfig/setup_linux/web_shortcuts/interactive.sh +10 -10
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +10 -10
- machineconfig/utils/code.py +1 -1
- machineconfig/utils/links.py +3 -2
- machineconfig/utils/ssh.py +1 -1
- {machineconfig-7.37.dist-info → machineconfig-7.39.dist-info}/METADATA +1 -1
- {machineconfig-7.37.dist-info → machineconfig-7.39.dist-info}/RECORD +34 -35
- machineconfig/scripts/python/helpers_repos/secure_repo.py +0 -15
- {machineconfig-7.37.dist-info → machineconfig-7.39.dist-info}/WHEEL +0 -0
- {machineconfig-7.37.dist-info → machineconfig-7.39.dist-info}/entry_points.txt +0 -0
- {machineconfig-7.37.dist-info → machineconfig-7.39.dist-info}/top_level.txt +0 -0
|
@@ -9,10 +9,8 @@ def copy_both_assets():
|
|
|
9
9
|
create_helper.copy_assets_to_machine(which="settings")
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def update(
|
|
12
|
+
def update(copy_assets: Annotated[bool, typer.Option("--assets-copy/--no-assets-copy", "-a/-na", help="Copy (overwrite) assets to the machine after the update")] = True):
|
|
13
13
|
"""🔄 UPDATE uv and machineconfig"""
|
|
14
|
-
# from machineconfig.utils.source_of_truth import LIBRARY_ROOT
|
|
15
|
-
# repo_root = LIBRARY_ROOT.parent.parent
|
|
16
14
|
from pathlib import Path
|
|
17
15
|
if Path.home().joinpath("code", "machineconfig").exists():
|
|
18
16
|
shell_script = """
|
|
@@ -36,7 +34,7 @@ uv tool install --upgrade machineconfig
|
|
|
36
34
|
else:
|
|
37
35
|
from machineconfig.utils.code import run_shell_script
|
|
38
36
|
run_shell_script(shell_script)
|
|
39
|
-
if
|
|
37
|
+
if copy_assets:
|
|
40
38
|
copy_both_assets()
|
|
41
39
|
|
|
42
40
|
def install(no_copy_assets: Annotated[bool, typer.Option("--no-assets-copy", "-na", help="Copy (overwrite) assets to the machine after the update")] = False):
|
|
@@ -48,9 +46,9 @@ def install(no_copy_assets: Annotated[bool, typer.Option("--no-assets-copy", "-n
|
|
|
48
46
|
else:
|
|
49
47
|
import platform
|
|
50
48
|
if platform.system() == "Windows":
|
|
51
|
-
run_shell_script(r"""& "$HOME\.local\bin\uv.exe" tool install --upgrade "machineconfig>=7.
|
|
49
|
+
run_shell_script(r"""& "$HOME\.local\bin\uv.exe" tool install --upgrade "machineconfig>=7.39" """)
|
|
52
50
|
else:
|
|
53
|
-
run_shell_script("""$HOME/.local/bin/uv tool install --upgrade "machineconfig>=7.
|
|
51
|
+
run_shell_script("""$HOME/.local/bin/uv tool install --upgrade "machineconfig>=7.39" """)
|
|
54
52
|
from machineconfig.profile.create_shell_profile import create_default_shell_profile
|
|
55
53
|
if not no_copy_assets:
|
|
56
54
|
create_default_shell_profile() # involves copying assets too
|
|
@@ -75,7 +73,7 @@ def navigate():
|
|
|
75
73
|
path = Path(navigator.__file__).resolve().parent.joinpath("devops_navigator.py")
|
|
76
74
|
from machineconfig.utils.code import run_shell_script
|
|
77
75
|
if Path.home().joinpath("code/machineconfig").exists(): executable = f"""--project "{str(Path.home().joinpath("code/machineconfig"))}" --with textual"""
|
|
78
|
-
else: executable = """--with "machineconfig>=7.
|
|
76
|
+
else: executable = """--with "machineconfig>=7.39,textual" """
|
|
79
77
|
run_shell_script(f"""uv run {executable} {path}""")
|
|
80
78
|
|
|
81
79
|
|
|
@@ -5,16 +5,16 @@ from typing import Annotated, Literal, Optional, TypedDict
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def copy(path: Annotated[str, typer.Argument(..., help="Path of the file to copy to clipboard")]):
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
# def copy(path: Annotated[str, typer.Argument(..., help="Path of the file to copy to clipboard")]):
|
|
9
|
+
# def copy_internal(path: str):
|
|
10
|
+
# import pyperclip
|
|
11
|
+
# from pathlib import Path
|
|
12
|
+
# pyperclip.copy(Path(path).read_text(encoding="utf-8"))
|
|
13
|
+
# from machineconfig.utils.meta import lambda_to_python_script
|
|
14
|
+
# from machineconfig.utils.code import exit_then_run_shell_script, get_uv_command_executing_python_script
|
|
15
|
+
# py_script = lambda_to_python_script(lambda: copy_internal(path=str(path)), in_global=True, import_module=False)
|
|
16
|
+
# shell_script, _python_file = get_uv_command_executing_python_script(python_script=py_script, uv_with=["pyperclip"], uv_project_dir=None)
|
|
17
|
+
# exit_then_run_shell_script(shell_script, strict=True)
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def download(
|
|
@@ -1,28 +1,47 @@
|
|
|
1
|
-
import git
|
|
2
|
-
from rich.console import Console
|
|
3
|
-
from rich.panel import Panel
|
|
4
|
-
import typer
|
|
5
1
|
|
|
6
|
-
from machineconfig.utils.path_extended import PathExtended
|
|
7
|
-
from machineconfig.utils.terminal import Response
|
|
8
|
-
from machineconfig.utils.source_of_truth import CONFIG_ROOT, DEFAULTS_PATH
|
|
9
|
-
from machineconfig.utils.code import get_uv_command_executing_python_script
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
import platform
|
|
12
|
-
import subprocess
|
|
13
2
|
from typing import Optional, Literal, Annotated
|
|
14
3
|
|
|
15
|
-
|
|
16
|
-
console = Console()
|
|
4
|
+
import typer
|
|
17
5
|
|
|
18
6
|
|
|
19
7
|
def main(
|
|
20
8
|
cloud: Annotated[Optional[str], typer.Option(..., "--cloud", "-c", help="Cloud storage profile name. If not provided, uses default from config.")] = None,
|
|
21
9
|
repo: Annotated[Optional[str], typer.Option(..., "--repo", "-r", help="Path to the local repository. Defaults to current working directory.")] = None,
|
|
22
10
|
message: Annotated[Optional[str], typer.Option(..., "--message", "-m", help="Commit message for local changes.")] = None,
|
|
23
|
-
on_conflict: Annotated[Literal["ask", "
|
|
11
|
+
on_conflict: Annotated[Literal["ask", "a",
|
|
12
|
+
"push-local-merge", "p",
|
|
13
|
+
"overwrite-local", "o",
|
|
14
|
+
"stop-on-conflict", "s",
|
|
15
|
+
"remove-rclone-conflict", "r"
|
|
16
|
+
], typer.Option(..., "--on-conflict", "-o", help="Action to take on merge conflict. Default is 'ask'.")] = "ask",
|
|
24
17
|
pwd: Annotated[Optional[str], typer.Option(..., "--password", help="Password for encryption/decryption of the remote repository.")] = None,
|
|
25
18
|
):
|
|
19
|
+
on_conflict_mapper: dict[str, Literal["ask", "push-local-merge", "overwrite-local", "stop-on-conflict", "remove-rclone-conflict"]] = {
|
|
20
|
+
"a": "ask",
|
|
21
|
+
"ask": "ask",
|
|
22
|
+
"p": "push-local-merge",
|
|
23
|
+
"push-local-merge": "push-local-merge",
|
|
24
|
+
"o": "overwrite-local",
|
|
25
|
+
"overwrite-local": "overwrite-local",
|
|
26
|
+
"s": "stop-on-conflict",
|
|
27
|
+
"stop-on-conflict": "stop-on-conflict",
|
|
28
|
+
"r": "remove-rclone-conflict",
|
|
29
|
+
"remove-rclone-conflict": "remove-rclone-conflict",
|
|
30
|
+
}
|
|
31
|
+
on_conflict = on_conflict_mapper[on_conflict]
|
|
32
|
+
import git
|
|
33
|
+
from rich.console import Console
|
|
34
|
+
from rich.panel import Panel
|
|
35
|
+
|
|
36
|
+
from machineconfig.utils.path_extended import PathExtended
|
|
37
|
+
from machineconfig.utils.terminal import Response
|
|
38
|
+
from machineconfig.utils.source_of_truth import CONFIG_ROOT, DEFAULTS_PATH
|
|
39
|
+
from machineconfig.utils.code import get_uv_command_executing_python_script
|
|
40
|
+
from pathlib import Path
|
|
41
|
+
import platform
|
|
42
|
+
import subprocess
|
|
43
|
+
console = Console()
|
|
44
|
+
|
|
26
45
|
if cloud is None:
|
|
27
46
|
try:
|
|
28
47
|
from machineconfig.utils.io import read_ini
|
|
@@ -80,7 +99,7 @@ git pull originEnc master
|
|
|
80
99
|
uv_project_dir = f"""{str(Path.home().joinpath("code/machineconfig"))}"""
|
|
81
100
|
uv_with = None
|
|
82
101
|
else:
|
|
83
|
-
uv_with = ["machineconfig>=7.
|
|
102
|
+
uv_with = ["machineconfig>=7.39"]
|
|
84
103
|
uv_project_dir = None
|
|
85
104
|
|
|
86
105
|
import tempfile
|
|
@@ -8,7 +8,7 @@ def analyze_repo_development(repo_path: Annotated[str, typer.Argument(..., help=
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
count_lines_path = Path(count_lines.__file__)
|
|
10
10
|
# --project $HOME/code/ machineconfig --group plot
|
|
11
|
-
cmd = f"""uv run --python 3.14 --with "machineconfig[plot]>=7.
|
|
11
|
+
cmd = f"""uv run --python 3.14 --with "machineconfig[plot]>=7.39" {count_lines_path} analyze-over-time {repo_path}"""
|
|
12
12
|
from machineconfig.utils.code import run_shell_script
|
|
13
13
|
run_shell_script(cmd)
|
|
14
14
|
|
|
@@ -9,6 +9,7 @@ from machineconfig.scripts.python.ftpx import ftpx as ftpx_func
|
|
|
9
9
|
from machineconfig.scripts.python.croshell import croshell as croshell_func
|
|
10
10
|
from machineconfig.scripts.python.fire_jobs import fire as get_fire_jobs_app
|
|
11
11
|
from machineconfig.scripts.python.define import get_app as get_define_app
|
|
12
|
+
from machineconfig.scripts.python.terminal import get_app as get_terminal_app
|
|
12
13
|
|
|
13
14
|
def get_app():
|
|
14
15
|
import typer
|
|
@@ -44,6 +45,12 @@ def get_app():
|
|
|
44
45
|
define_app = get_define_app()
|
|
45
46
|
app.add_typer(define_app, name="define", help="[df] Define and manage configurations", no_args_is_help=True)
|
|
46
47
|
app.add_typer(define_app, name="df", hidden=True) # short alias
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
terminal_app = get_terminal_app()
|
|
51
|
+
app.add_typer(terminal_app, name="terminal", help="[t] Terminal management commands", no_args_is_help=True)
|
|
52
|
+
app.add_typer(terminal_app, name="t", hidden=True) # short alias
|
|
53
|
+
|
|
47
54
|
return app
|
|
48
55
|
|
|
49
56
|
|
|
@@ -22,11 +22,13 @@ def choose_zellij_session(
|
|
|
22
22
|
cmd = f"""zellij kill-sessions
|
|
23
23
|
{cmd}"""
|
|
24
24
|
from machineconfig.utils.code import exit_then_run_shell_script
|
|
25
|
-
exit_then_run_shell_script(cmd, strict=True)
|
|
25
|
+
exit_then_run_shell_script(script=cmd, strict=True)
|
|
26
26
|
typer.Exit()
|
|
27
27
|
return
|
|
28
28
|
cmd = "zellij list-sessions"
|
|
29
29
|
sessions: list[str] = subprocess.check_output(cmd, shell=True).decode().strip().split("\n")
|
|
30
|
+
# filter out empty lines and keep raw lines (they contain creation info)
|
|
31
|
+
sessions = [s for s in sessions if s.strip()]
|
|
30
32
|
sessions.sort(key=lambda s: "EXITED" in s)
|
|
31
33
|
if "current" in sessions:
|
|
32
34
|
print("Already in a Zellij session, avoiding nesting and exiting.")
|
|
@@ -40,7 +42,18 @@ def choose_zellij_session(
|
|
|
40
42
|
result = f"zellij attach {session}"
|
|
41
43
|
else:
|
|
42
44
|
from machineconfig.utils.options import choose_from_options
|
|
43
|
-
|
|
45
|
+
# Artificially inject a "NEW SESSION" option so the user can create one from the list
|
|
46
|
+
NEW_SESSION_LABEL = "NEW SESSION"
|
|
47
|
+
options = [NEW_SESSION_LABEL] + sessions
|
|
48
|
+
session = choose_from_options(msg="Choose a Zellij session to attach to:", multi=False, options=options, fzf=True)
|
|
49
|
+
# If the user chose the artificial option, start a new session (same as --new-session)
|
|
50
|
+
if session == NEW_SESSION_LABEL:
|
|
51
|
+
cmd = "zellij --layout st2"
|
|
52
|
+
if kill_all:
|
|
53
|
+
cmd = f"zellij kill-sessions\n{cmd}"
|
|
54
|
+
from machineconfig.utils.code import exit_then_run_shell_script
|
|
55
|
+
exit_then_run_shell_script(cmd, strict=True)
|
|
56
|
+
raise typer.Exit()
|
|
44
57
|
session = session.split(" [Created")[0]
|
|
45
58
|
result = f"zellij attach {session}"
|
|
46
59
|
from machineconfig.utils.code import exit_then_run_shell_script
|
|
@@ -93,7 +106,7 @@ def start_wt(layout_name: Annotated[str, typer.Argument(help="Layout name to sta
|
|
|
93
106
|
# exit_then_run_shell_script(cmd, strict=True)
|
|
94
107
|
|
|
95
108
|
|
|
96
|
-
def
|
|
109
|
+
def get_app():
|
|
97
110
|
app = typer.Typer(help="🖥️ Terminal utilities", no_args_is_help=True, add_help_option=False)
|
|
98
111
|
app.command(name="attach-to-zellij", no_args_is_help=False, help="[z] Choose a Zellij session to attach to")(choose_zellij_session)
|
|
99
112
|
app.command(name="z", hidden=True, no_args_is_help=False, help="[z] Choose a Zellij session to attach to")(choose_zellij_session)
|
|
@@ -103,6 +116,10 @@ def main():
|
|
|
103
116
|
|
|
104
117
|
app.command(name="get-session-tabs", no_args_is_help=False, help="[zt] Get all Zellij session tabs.")(get_session_tabs)
|
|
105
118
|
app.command(name="zt", hidden=True, no_args_is_help=False, help="[zt] Get all Zellij session tabs.")(get_session_tabs)
|
|
119
|
+
return app
|
|
120
|
+
|
|
121
|
+
def main():
|
|
122
|
+
app = get_app()
|
|
106
123
|
app()
|
|
107
124
|
|
|
108
125
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
from machineconfig.scripts.python.helpers_devops.cli_utils import download, merge_pdfs, get_machine_specs, init_project, compress_pdf
|
|
3
|
+
from machineconfig.scripts.python.helpers_devops.cli_utils import download, merge_pdfs, get_machine_specs, init_project, compress_pdf
|
|
4
4
|
import typer
|
|
5
5
|
from typing import Annotated
|
|
6
6
|
|
|
@@ -45,8 +45,8 @@ def get_app() -> typer.Typer:
|
|
|
45
45
|
app.command(name="pdf-compress", no_args_is_help=True, help="[pc] Compress a PDF file.")(compress_pdf)
|
|
46
46
|
app.command(name="pc", no_args_is_help=True, hidden=True)(compress_pdf)
|
|
47
47
|
|
|
48
|
-
app.command(name="copy", no_args_is_help=True, help="[c] Copy files or directories.")(copy)
|
|
49
|
-
app.command(name="c", no_args_is_help=True, hidden=True)(copy)
|
|
48
|
+
# app.command(name="copy", no_args_is_help=True, help="[c] Copy files or directories.")(copy)
|
|
49
|
+
# app.command(name="c", no_args_is_help=True, hidden=True)(copy)
|
|
50
50
|
|
|
51
51
|
return app
|
|
52
52
|
|
|
@@ -7,7 +7,7 @@ $user = ''
|
|
|
7
7
|
$sharePath = ''
|
|
8
8
|
$driveLetter = ''
|
|
9
9
|
|
|
10
|
-
uv run --python 3.14 --with "machineconfig>=7.
|
|
10
|
+
uv run --python 3.14 --with "machineconfig>=7.39" python -m machineconfig.scripts.python.mount_ssh
|
|
11
11
|
|
|
12
12
|
net use T: \\sshfs.kr\$user@$host.local
|
|
13
13
|
# this worked: net use T: \\sshfs\alex@alex-p51s-5.local
|
|
@@ -31,6 +31,11 @@ function wrap_in_shell_script {
|
|
|
31
31
|
# Check if the file exists
|
|
32
32
|
if (Test-Path $env:OP_PROGRAM_PATH) {
|
|
33
33
|
Write-Host "🚀 Taking over from python script @ $env:OP_PROGRAM_PATH"
|
|
34
|
+
try {
|
|
35
|
+
bat --style=full --theme=OneHalfDark --paging=never "$env:OP_PROGRAM_PATH"
|
|
36
|
+
} catch {
|
|
37
|
+
Write-Host "⚠️ Warning: Failed to display script content with 'bat'. Proceeding to execute the script."
|
|
38
|
+
}
|
|
34
39
|
& $env:OP_PROGRAM_PATH
|
|
35
40
|
Write-Host "✅ '$Command' execution completed."
|
|
36
41
|
} else {
|
|
@@ -1,33 +1,3 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
alias l = lsd -la
|
|
5
|
-
alias d = devops
|
|
6
|
-
alias c = cloud
|
|
7
|
-
alias a = agents
|
|
8
|
-
alias s = sessions
|
|
9
|
-
alias ff = ftpx
|
|
10
|
-
alias f = fire
|
|
11
|
-
alias r = croshell
|
|
12
|
-
alias u = utils
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# as per https://github.com/starship/starship?tab=readme-ov-file#step-1-install-starship
|
|
16
|
-
# $nu.config-path
|
|
17
|
-
use ~/.cache/starship/init.nu
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# https://github.com/fdncred/nu_plugin_parquet
|
|
21
|
-
# plugin add ~/.cargo/bin/nu_plugin_parquet
|
|
22
|
-
# https://github.com/FMotalleb/nu_plugin_port_list
|
|
23
|
-
# plugin add ~/.cargo/bin/nu_plugin_port_list
|
|
24
|
-
# https://github.com/FMotalleb/nu_plugin_qr_maker
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
# source /home/alex/.config/broot/launcher/nushell/br
|
|
28
|
-
# use '/home/alex/.config/broot/launcher/nushell/br' *
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# as per https://github.com/ajeetdsouza/zoxide?tab=readme-ov-file#installation
|
|
32
|
-
source ~/.zoxide.nu
|
|
33
|
-
|
|
3
|
+
use C:\Users\aalsaf01\.config\machineconfig\settings\shells\nushell\init.nu
|
|
@@ -1,48 +1,110 @@
|
|
|
1
1
|
# Nushell initialization script
|
|
2
2
|
# Translation of init.ps1 to Nushell
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
|
|
6
6
|
# Add directories to PATH if not already present
|
|
7
7
|
def add_to_path_if_not_already [...directories: string] {
|
|
8
|
+
let raw_path = ($env.PATH? | default [])
|
|
9
|
+
let path_type = ($raw_path | describe)
|
|
10
|
+
|
|
11
|
+
mut path_entries = if $path_type == "string" {
|
|
12
|
+
$raw_path | split row (char esep)
|
|
13
|
+
} else if $path_type == "list<string>" {
|
|
14
|
+
$raw_path
|
|
15
|
+
} else if $path_type == "nothing" {
|
|
16
|
+
[]
|
|
17
|
+
} else {
|
|
18
|
+
[]
|
|
19
|
+
}
|
|
20
|
+
|
|
8
21
|
for dir in $directories {
|
|
9
|
-
if $dir not-in $
|
|
10
|
-
$
|
|
22
|
+
if $dir not-in $path_entries {
|
|
23
|
+
$path_entries = ($path_entries | append $dir)
|
|
11
24
|
}
|
|
12
25
|
}
|
|
26
|
+
|
|
27
|
+
$path_entries
|
|
13
28
|
}
|
|
14
29
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
$
|
|
18
|
-
|
|
19
|
-
"/usr/local/bin"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# Source external scripts and define aliases
|
|
23
|
-
if ($"($
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
export-env {
|
|
31
|
+
let config_root = $"($env.HOME)/.config/machineconfig"
|
|
32
|
+
load-env { CONFIG_ROOT: $config_root }
|
|
33
|
+
|
|
34
|
+
let new_path = (add_to_path_if_not_already $"($config_root)/scripts/linux" $"($env.HOME)/dotfiles/scripts/linux" "/usr/local/bin")
|
|
35
|
+
load-env { PATH: $new_path }
|
|
36
|
+
|
|
37
|
+
# Source external scripts and define aliases
|
|
38
|
+
if ($"($config_root)/scripts/linux" | path exists) {
|
|
39
|
+
# Source helper scripts
|
|
40
|
+
# let broot_script = ($config_root | path join "settings" "broot" "brootcd.nu")
|
|
41
|
+
# let lf_script = ($config_root | path join "settings" "lf" "linux" "lfcd.nu")
|
|
42
|
+
# let tere_script = ($config_root | path join "settings" "tere" "terecd.nu")
|
|
43
|
+
|
|
44
|
+
def wrap_in_shell_script [command: string ...args: string] -> nothing {
|
|
45
|
+
let op_dir = ($env.HOME | path join "tmp_results" "tmp_scripts" "machineconfig")
|
|
46
|
+
if ($op_dir | path exists) == false {
|
|
47
|
+
try { mkdir $op_dir } catch { null }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let random_name = (random uuid | str replace "-" "" | str substring 0..16)
|
|
51
|
+
let op_program_path = ($op_dir | path join $"($random_name).sh")
|
|
52
|
+
let timestamp = (date now --utc | format date "%Y-%m-%d %H:%M:%SZ")
|
|
53
|
+
|
|
54
|
+
print $"machineconfig: running ($command) at ($timestamp)"
|
|
55
|
+
|
|
56
|
+
let status = (try {
|
|
57
|
+
with-env { OP_PROGRAM_PATH: $op_program_path } {
|
|
58
|
+
run-external $command ...$args
|
|
59
|
+
$env.LAST_EXIT_CODE? | default 0
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
1
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
if ($op_program_path | path exists) {
|
|
66
|
+
if (which bat | is-empty) {
|
|
67
|
+
print (open --raw $op_program_path)
|
|
68
|
+
} else {
|
|
69
|
+
run-external bat "--style=plain" "--paging=never" $op_program_path
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let follow_status = (try {
|
|
73
|
+
run-external bash $op_program_path
|
|
74
|
+
$env.LAST_EXIT_CODE? | default 0
|
|
75
|
+
} catch {
|
|
76
|
+
1
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
if $follow_status == 0 {
|
|
80
|
+
print $"machineconfig: completed '$command'"
|
|
81
|
+
} else {
|
|
82
|
+
print $"machineconfig: program exited with status ($follow_status)"
|
|
83
|
+
}
|
|
84
|
+
} else if $status == 0 {
|
|
85
|
+
print $"machineconfig: completed '$command'"
|
|
86
|
+
} else {
|
|
87
|
+
print $"machineconfig: '$command' exited with status ($status)"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# Define aliases and custom commands
|
|
92
|
+
def lsdla [] { lsd -la }
|
|
93
|
+
alias l = lsdla
|
|
94
|
+
|
|
95
|
+
def d [...args: string] { wrap_in_shell_script devops ...$args }
|
|
96
|
+
def c [...args: string] { wrap_in_shell_script cloud ...$args }
|
|
97
|
+
def a [...args: string] { wrap_in_shell_script agents ...$args }
|
|
98
|
+
def ss [...args: string] { wrap_in_shell_script sessions ...$args }
|
|
99
|
+
def ff [...args: string] { wrap_in_shell_script ftpx ...$args }
|
|
100
|
+
def f [...args: string] { wrap_in_shell_script fire ...$args }
|
|
101
|
+
def rr [...args: string] { wrap_in_shell_script croshell ...$args }
|
|
102
|
+
def u [...args: string] { wrap_in_shell_script utils ...$args }
|
|
103
|
+
def t [...args: string] { wrap_in_shell_script terminal ...$args }
|
|
104
|
+
def ms [...args: string] { wrap_in_shell_script msearch ...$args }
|
|
105
|
+
} else {
|
|
106
|
+
print $"Missing config files: ($config_root)"
|
|
107
|
+
}
|
|
46
108
|
}
|
|
47
109
|
|
|
48
110
|
# Initialize zoxide if available
|
|
@@ -59,3 +121,7 @@ try {
|
|
|
59
121
|
} catch {
|
|
60
122
|
# Do nothing if starship is not available
|
|
61
123
|
}
|
|
124
|
+
# as per https://github.com/starship/starship?tab=readme-ov-file#step-1-install-starship
|
|
125
|
+
# $nu.config-path
|
|
126
|
+
# use ~/.cache/starship/init.nu
|
|
127
|
+
|
|
@@ -99,14 +99,22 @@
|
|
|
99
99
|
"name": "Command Prompt"
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
|
-
"guid": "{
|
|
102
|
+
"guid": "{b1bc5929-2f8d-5b56-8c51-3e83379a5b63}",
|
|
103
103
|
"hidden": false,
|
|
104
104
|
"commandline": "nu.exe",
|
|
105
105
|
"name": "nushell"
|
|
106
106
|
// "source": "Windows.Terminal.Azure"
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
|
-
"guid": "{
|
|
109
|
+
"guid": "{4b9d9cef-cb7d-4a8c-8b08-0de52621c3ff}",
|
|
110
|
+
"hidden": false,
|
|
111
|
+
"commandline": "nu.exe",
|
|
112
|
+
"name": "nushell2",
|
|
113
|
+
"font": {
|
|
114
|
+
"face": "CaskaydiaCove Nerd Font"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
110
118
|
"hidden": false,
|
|
111
119
|
"name": "Developer Command Prompt for VS 2022",
|
|
112
120
|
"source": "Windows.Terminal.VisualStudio"
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
. <( curl -sSL "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/uv.sh")
|
|
3
3
|
. <( curl -sSL "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/scripts/linux/wrap_mcfg")
|
|
4
4
|
|
|
5
|
-
alias devops='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
6
|
-
alias cloud='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
7
|
-
alias agents='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
8
|
-
alias sessions='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
9
|
-
alias ftpx='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
10
|
-
alias fire='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
11
|
-
alias croshell='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
12
|
-
alias utils='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
13
|
-
alias terminal='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
14
|
-
alias msearch='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.
|
|
5
|
+
alias devops='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" devops'
|
|
6
|
+
alias cloud='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" cloud'
|
|
7
|
+
alias agents='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" agents'
|
|
8
|
+
alias sessions='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" sessions'
|
|
9
|
+
alias ftpx='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" ftpx'
|
|
10
|
+
alias fire='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" fire'
|
|
11
|
+
alias croshell='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" croshell'
|
|
12
|
+
alias utils='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" utils'
|
|
13
|
+
alias terminal='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" terminal'
|
|
14
|
+
alias msearch='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.39" msearch'
|
|
15
15
|
|
|
16
16
|
alias d='wrap_in_shell_script devops'
|
|
17
17
|
alias c='wrap_in_shell_script cloud'
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
iex (iwr "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/uv.ps1").Content
|
|
4
4
|
iex (iwr "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/scripts/windows/wrap_mcfg.ps1").Content
|
|
5
5
|
|
|
6
|
-
function devops { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
7
|
-
function cloud { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
8
|
-
function agents { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
9
|
-
function sessions { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
10
|
-
function ftpx { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
11
|
-
function fire { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
12
|
-
function croshell { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
13
|
-
function utils { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
14
|
-
function terminal { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
15
|
-
function msearch { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.
|
|
6
|
+
function devops { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" devops $args }
|
|
7
|
+
function cloud { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" cloud $args }
|
|
8
|
+
function agents { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" agents $args }
|
|
9
|
+
function sessions { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" sessions $args }
|
|
10
|
+
function ftpx { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" ftpx $args }
|
|
11
|
+
function fire { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" fire $args }
|
|
12
|
+
function croshell { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" croshell $args }
|
|
13
|
+
function utils { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" utils $args }
|
|
14
|
+
function terminal { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" terminal $args }
|
|
15
|
+
function msearch { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.39" msearch $args }
|
|
16
16
|
|
|
17
17
|
function d { wrap_in_shell_script devops @args }
|
|
18
18
|
function c { wrap_in_shell_script cloud @args }
|
machineconfig/utils/code.py
CHANGED
|
@@ -129,7 +129,7 @@ def exit_then_run_shell_script(script: str, strict: bool = False):
|
|
|
129
129
|
else:
|
|
130
130
|
suffix = ".sh"
|
|
131
131
|
lexer = "bash"
|
|
132
|
-
op_program_path = Path.home().joinpath("tmp_results", "tmp_scripts", "manual_run", f"manual_script_{randstr()}
|
|
132
|
+
op_program_path = Path.home().joinpath("tmp_results", "tmp_scripts", "manual_run", f"manual_script_{randstr()}{suffix}")
|
|
133
133
|
op_program_path.parent.mkdir(parents=True, exist_ok=True)
|
|
134
134
|
op_program_path.write_text(script, encoding="utf-8")
|
|
135
135
|
print_code(script, lexer=lexer, desc="script to run manually")
|
machineconfig/utils/links.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from machineconfig.utils.path_extended import PathExtended, PLike
|
|
2
|
+
from machineconfig.profile.create_links_export import ON_CONFLICT_STRICT
|
|
2
3
|
from machineconfig.utils.accessories import randstr
|
|
3
4
|
from rich.console import Console
|
|
4
5
|
from rich.panel import Panel
|
|
@@ -96,7 +97,7 @@ def build_links(target_paths: list[tuple[PLike, str]], repo_root: PLike):
|
|
|
96
97
|
|
|
97
98
|
|
|
98
99
|
def symlink_map(config_file_default_path: PathExtended, self_managed_config_file_path: PathExtended,
|
|
99
|
-
on_conflict:
|
|
100
|
+
on_conflict: ON_CONFLICT_STRICT
|
|
100
101
|
) -> OperationResult:
|
|
101
102
|
"""helper function. creates a symlink from `config_file_default_path` to `self_managed_config_file_path`.
|
|
102
103
|
|
|
@@ -244,7 +245,7 @@ def symlink_map(config_file_default_path: PathExtended, self_managed_config_file
|
|
|
244
245
|
return {"action": action_taken, "details": details}
|
|
245
246
|
|
|
246
247
|
|
|
247
|
-
def copy_map(config_file_default_path: PathExtended, self_managed_config_file_path: PathExtended, on_conflict:
|
|
248
|
+
def copy_map(config_file_default_path: PathExtended, self_managed_config_file_path: PathExtended, on_conflict: ON_CONFLICT_STRICT) -> OperationResult:
|
|
248
249
|
config_file_default_path = PathExtended(config_file_default_path).expanduser().absolute()
|
|
249
250
|
self_managed_config_file_path = PathExtended(self_managed_config_file_path).expanduser().absolute()
|
|
250
251
|
|
machineconfig/utils/ssh.py
CHANGED
|
@@ -8,7 +8,7 @@ from machineconfig.utils.terminal import Response
|
|
|
8
8
|
from machineconfig.utils.accessories import pprint, randstr
|
|
9
9
|
from machineconfig.utils.meta import lambda_to_python_script
|
|
10
10
|
UV_RUN_CMD = "$HOME/.local/bin/uv run" if platform.system() != "Windows" else """& "$env:USERPROFILE/.local/bin/uv" run"""
|
|
11
|
-
MACHINECONFIG_VERSION = "machineconfig>=7.
|
|
11
|
+
MACHINECONFIG_VERSION = "machineconfig>=7.39"
|
|
12
12
|
DEFAULT_PICKLE_SUBDIR = "tmp_results/tmp_scripts/ssh"
|
|
13
13
|
|
|
14
14
|
class SSH:
|