machineconfig 7.38__py3-none-any.whl → 7.44__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 +34 -0
- machineconfig/profile/create_links.py +2 -1
- machineconfig/profile/create_links_export.py +43 -11
- machineconfig/profile/create_shell_profile.py +64 -124
- machineconfig/profile/mapper.toml +4 -0
- 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/explore.py +49 -0
- machineconfig/scripts/python/helpers_devops/cli_config.py +27 -31
- machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +12 -9
- machineconfig/scripts/python/helpers_devops/cli_nw.py +7 -6
- 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_share_file.py +137 -0
- machineconfig/scripts/python/helpers_devops/cli_share_server.py +62 -166
- 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/windows/mounts/mount_ssh.ps1 +1 -1
- machineconfig/scripts/windows/wrap_mcfg.ps1 +5 -0
- machineconfig/settings/helix/config.toml +14 -0
- machineconfig/settings/lf/linux/exe/lfcd.sh +1 -0
- machineconfig/settings/lf/linux/exe/previewer.sh +3 -2
- machineconfig/settings/shells/bash/init.sh +2 -1
- 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/settings/yazi/init.lua +36 -0
- machineconfig/settings/yazi/keymap.toml +52 -0
- machineconfig/settings/yazi/shell/yazi_cd.sh +8 -0
- machineconfig/settings/yazi/yazi.toml +8 -0
- 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.38.dist-info → machineconfig-7.44.dist-info}/METADATA +1 -1
- {machineconfig-7.38.dist-info → machineconfig-7.44.dist-info}/RECORD +44 -41
- {machineconfig-7.38.dist-info → machineconfig-7.44.dist-info}/entry_points.txt +1 -0
- machineconfig/scripts/python/helpers_repos/secure_repo.py +0 -15
- {machineconfig-7.38.dist-info → machineconfig-7.44.dist-info}/WHEEL +0 -0
- {machineconfig-7.38.dist-info → machineconfig-7.44.dist-info}/top_level.txt +0 -0
|
@@ -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.40"]
|
|
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.40" {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
|
|
|
@@ -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.40" 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 {
|
|
@@ -25,3 +25,17 @@ enable = true
|
|
|
25
25
|
max-wrap = 25 # increase value to reduce forced mid-word wrapping
|
|
26
26
|
max-indent-retain = 0
|
|
27
27
|
wrap-indicator = "" # set wrap-indicator to "" to hide it
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# https://yazi-rs.github.io/docs/tips#helix-with-zellij
|
|
31
|
+
# ~/.config/helix/config.toml
|
|
32
|
+
[keys.normal]
|
|
33
|
+
C-y = ":sh zellij run -n Yazi -c -f -x 10%% -y 10%% --width 80%% --height 80%% -- bash ~/.config/helix/yazi-picker.sh open %{buffer_name}"
|
|
34
|
+
# ~/.config/helix/config.toml
|
|
35
|
+
[keys.normal.C-y]
|
|
36
|
+
# Open the file(s) in the current window
|
|
37
|
+
y = ":sh zellij run -n Yazi -c -f -x 10%% -y 10%% --width 80%% --height 80%% -- bash ~/.config/helix/yazi-picker.sh open %{buffer_name}"
|
|
38
|
+
# Open the file(s) in a vertical split
|
|
39
|
+
v = ":sh zellij run -n Yazi -c -f -x 10%% -y 10%% --width 80%% --height 80%% -- bash ~/.config/helix/yazi-picker.sh vsplit %{buffer_name}"
|
|
40
|
+
# Open the file(s) in a horizontal split
|
|
41
|
+
h = ":sh zellij run -n Yazi -c -f -x 10%% -y 10%% --width 80%% --height 80%% -- bash ~/.config/helix/yazi-picker.sh hsplit %{buffer_name}"
|
|
@@ -20,8 +20,9 @@ case "$file" in
|
|
|
20
20
|
echo "x: $x, y: $y, width: $width, height: $height"
|
|
21
21
|
|
|
22
22
|
if [ -n "$x" ]; then
|
|
23
|
-
echo "📐 Dimensions provided by caller, passing to viu"
|
|
24
|
-
viu "$file" -x "$x" -y "$y" -w "$width" -h "$height"
|
|
23
|
+
# echo "📐 Dimensions provided by caller, passing to viu"
|
|
24
|
+
# viu "$file" -x "$x" -y "$y" -w "$width" -h "$height"
|
|
25
|
+
# chafa --fit-width -f sixel "$file"
|
|
25
26
|
echo "✅ Finished viu"
|
|
26
27
|
chafa "$file"
|
|
27
28
|
echo "✅ Finished chafa"
|
|
@@ -37,6 +37,7 @@ add_to_path_if_not_already \
|
|
|
37
37
|
. $CONFIG_ROOT/settings/broot/br.sh
|
|
38
38
|
. $CONFIG_ROOT/settings/lf/linux/exe/lfcd.sh
|
|
39
39
|
. $CONFIG_ROOT/settings/tere/terecd.sh
|
|
40
|
+
. $CONFIG_ROOT/settings/yazi/shell/yazi_cd.sh
|
|
40
41
|
. $CONFIG_ROOT/scripts/linux/wrap_mcfg
|
|
41
42
|
|
|
42
43
|
# check if file in ~/dotfiles/machineconfig/init_linux.sh exists and source it
|
|
@@ -56,7 +57,7 @@ alias r='wrap_in_shell_script croshell'
|
|
|
56
57
|
alias u='wrap_in_shell_script utils'
|
|
57
58
|
alias t='wrap_in_shell_script terminal'
|
|
58
59
|
alias ms='wrap_in_shell_script msearch'
|
|
59
|
-
|
|
60
|
+
alias x='. $CONFIG_ROOT/scripts/linux/wrap_mcfg explore'
|
|
60
61
|
|
|
61
62
|
# alias gcs='gh copilot suggest -t shell'
|
|
62
63
|
# alias gcg='gh copilot suggest -t git'
|
|
@@ -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"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
-- https://yazi-rs.github.io/docs/tips#symlink-in-status
|
|
4
|
+
-- Status:children_add(function(self)
|
|
5
|
+
-- local h = self._current.hovered
|
|
6
|
+
-- if h and h.link_to then
|
|
7
|
+
-- return " -> " .. tostring(h.link_to)
|
|
8
|
+
-- else
|
|
9
|
+
-- return ""
|
|
10
|
+
-- end
|
|
11
|
+
-- end, 3300, Status.LEFT)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
-- https://yazi-rs.github.io/docs/tips#user-group-in-status
|
|
15
|
+
-- Status:children_add(function()
|
|
16
|
+
-- local h = cx.active.current.hovered
|
|
17
|
+
-- if not h or ya.target_family() ~= "unix" then
|
|
18
|
+
-- return ""
|
|
19
|
+
-- end
|
|
20
|
+
|
|
21
|
+
-- return ui.Line {
|
|
22
|
+
-- ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
|
|
23
|
+
-- ":",
|
|
24
|
+
-- ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
|
|
25
|
+
-- " ",
|
|
26
|
+
-- }
|
|
27
|
+
-- end, 500, Status.RIGHT)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
-- https://yazi-rs.github.io/docs/tips#username-hostname-in-header
|
|
31
|
+
-- Header:children_add(function()
|
|
32
|
+
-- if ya.target_family() ~= "unix" then
|
|
33
|
+
-- return ""
|
|
34
|
+
-- end
|
|
35
|
+
-- return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue")
|
|
36
|
+
-- end, 500, Header.LEFT)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
[[mgr.prepend_keymap]]
|
|
3
|
+
on = "!"
|
|
4
|
+
for = "unix"
|
|
5
|
+
run = 'shell "$SHELL" --block'
|
|
6
|
+
desc = "Open $SHELL here"
|
|
7
|
+
|
|
8
|
+
# If you also using Yazi on Windows:
|
|
9
|
+
[[mgr.prepend_keymap]]
|
|
10
|
+
on = "!"
|
|
11
|
+
for = "windows"
|
|
12
|
+
run = 'shell "powershell.exe" --block'
|
|
13
|
+
desc = "Open PowerShell here"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# FROM https://github.com/yazi-rs/plugins/tree/main/toggle-pane.yazi
|
|
17
|
+
# keymap.toml
|
|
18
|
+
[[mgr.prepend_keymap]]
|
|
19
|
+
on = "T"
|
|
20
|
+
run = "plugin toggle-pane min-preview"
|
|
21
|
+
desc = "Show or hide the preview pane"
|
|
22
|
+
# keymap.toml
|
|
23
|
+
[[mgr.prepend_keymap]]
|
|
24
|
+
on = "T"
|
|
25
|
+
run = "plugin toggle-pane max-preview"
|
|
26
|
+
desc = "Maximize or restore the preview pane"
|
|
27
|
+
|
|
28
|
+
[[mgr.prepend_keymap]]
|
|
29
|
+
on = "M" # whatever key you choose
|
|
30
|
+
run = "plugin toggle-pane"
|
|
31
|
+
desc = "Toggle preview pane / maximize pane"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# https://yazi-rs.github.io/docs/tips#macos-quick-look
|
|
35
|
+
[[mgr.prepend_keymap]]
|
|
36
|
+
on = "<C-p>"
|
|
37
|
+
run = 'shell -- qlmanage -p "$@"'
|
|
38
|
+
|
|
39
|
+
[[mgr.prepend_keymap]]
|
|
40
|
+
on = "F"
|
|
41
|
+
run = 'shell -- ~/.config/machineconfig/scripts/linux/wrap_mcfg fire "$0"'
|
|
42
|
+
desc = "Run fire on hovered file"
|
|
43
|
+
|
|
44
|
+
[[mgr.prepend_keymap]]
|
|
45
|
+
on = "R"
|
|
46
|
+
run = 'shell -- ~/.config/machineconfig/scripts/linux/wrap_mcfg croshell "$0"'
|
|
47
|
+
desc = "Run croshell on hovered file"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
[[mgr.prepend_keymap]]
|
|
51
|
+
on = [ "g", "r" ]
|
|
52
|
+
run = 'shell -- ya emit cd "$(git rev-parse --show-toplevel)"'
|
|
@@ -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.40" devops'
|
|
6
|
+
alias cloud='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.40" cloud'
|
|
7
|
+
alias agents='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.40" agents'
|
|
8
|
+
alias sessions='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.40" sessions'
|
|
9
|
+
alias ftpx='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.40" ftpx'
|
|
10
|
+
alias fire='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.40" fire'
|
|
11
|
+
alias croshell='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.40" croshell'
|
|
12
|
+
alias utils='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.40" utils'
|
|
13
|
+
alias terminal='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.40" terminal'
|
|
14
|
+
alias msearch='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.40" 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.40" devops $args }
|
|
7
|
+
function cloud { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.40" cloud $args }
|
|
8
|
+
function agents { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.40" agents $args }
|
|
9
|
+
function sessions { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.40" sessions $args }
|
|
10
|
+
function ftpx { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.40" ftpx $args }
|
|
11
|
+
function fire { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.40" fire $args }
|
|
12
|
+
function croshell { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.40" croshell $args }
|
|
13
|
+
function utils { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.40" utils $args }
|
|
14
|
+
function terminal { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.40" terminal $args }
|
|
15
|
+
function msearch { & "$HOME\.local\bin\uvx.exe" --python 3.14 --from "machineconfig>=7.40" 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")
|