machineconfig 2.0__py3-none-any.whl ā 2.2__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/cloud_manager.py +0 -3
- machineconfig/cluster/data_transfer.py +0 -1
- machineconfig/cluster/file_manager.py +0 -1
- machineconfig/cluster/job_params.py +0 -3
- machineconfig/cluster/loader_runner.py +0 -3
- machineconfig/cluster/remote_machine.py +0 -1
- machineconfig/cluster/script_notify_upon_completion.py +0 -1
- machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +5 -6
- machineconfig/cluster/sessions_managers/archive/session_managers.py +0 -1
- machineconfig/cluster/sessions_managers/enhanced_command_runner.py +17 -57
- machineconfig/cluster/sessions_managers/wt_local.py +36 -110
- machineconfig/cluster/sessions_managers/wt_local_manager.py +42 -112
- machineconfig/cluster/sessions_managers/wt_remote.py +23 -30
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +20 -62
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +10 -15
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +27 -127
- machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +10 -43
- machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +22 -101
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +11 -39
- machineconfig/cluster/sessions_managers/zellij_local.py +49 -102
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +34 -78
- machineconfig/cluster/sessions_managers/zellij_remote.py +17 -24
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +7 -13
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +4 -2
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +6 -6
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +18 -88
- machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +2 -6
- machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +12 -40
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +3 -2
- machineconfig/cluster/templates/cli_click.py +0 -1
- machineconfig/cluster/templates/cli_gooey.py +0 -2
- machineconfig/cluster/templates/cli_trogon.py +0 -1
- machineconfig/cluster/templates/run_cloud.py +0 -1
- machineconfig/cluster/templates/run_cluster.py +0 -1
- machineconfig/cluster/templates/run_remote.py +0 -1
- machineconfig/cluster/templates/utils.py +27 -46
- machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/linux/msc/cli_agents.sh +16 -0
- machineconfig/jobs/python/check_installations.py +2 -1
- machineconfig/jobs/python/create_bootable_media.py +0 -2
- machineconfig/jobs/python/python_ve_symlink.py +9 -11
- machineconfig/jobs/python/tasks.py +0 -1
- machineconfig/jobs/python/vscode/api.py +5 -5
- machineconfig/jobs/python/vscode/link_ve.py +13 -14
- machineconfig/jobs/python/vscode/select_interpreter.py +21 -22
- machineconfig/jobs/python/vscode/sync_code.py +9 -13
- machineconfig/jobs/python_custom_installers/archive/ngrok.py +13 -13
- machineconfig/jobs/python_custom_installers/dev/aider.py +7 -15
- machineconfig/jobs/python_custom_installers/dev/alacritty.py +9 -18
- machineconfig/jobs/python_custom_installers/dev/brave.py +10 -19
- machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +8 -15
- machineconfig/jobs/python_custom_installers/dev/code.py +12 -32
- machineconfig/jobs/python_custom_installers/dev/cursor.py +3 -14
- machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +8 -7
- machineconfig/jobs/python_custom_installers/dev/espanso.py +15 -19
- machineconfig/jobs/python_custom_installers/dev/goes.py +5 -12
- machineconfig/jobs/python_custom_installers/dev/lvim.py +9 -17
- machineconfig/jobs/python_custom_installers/dev/nerdfont.py +12 -19
- machineconfig/jobs/python_custom_installers/dev/redis.py +12 -20
- machineconfig/jobs/python_custom_installers/dev/wezterm.py +12 -19
- machineconfig/jobs/python_custom_installers/dev/winget.py +5 -23
- machineconfig/jobs/python_custom_installers/docker.py +12 -21
- machineconfig/jobs/python_custom_installers/gh.py +11 -19
- machineconfig/jobs/python_custom_installers/hx.py +32 -16
- machineconfig/jobs/python_custom_installers/warp-cli.py +12 -20
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_generic_installers/config.json +1 -1
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/windows/archive/archive_pygraphviz.ps1 +1 -1
- machineconfig/jobs/windows/msc/cli_agents.bat +0 -0
- machineconfig/jobs/windows/msc/cli_agents.ps1 +0 -0
- machineconfig/jobs/windows/start_terminal.ps1 +1 -1
- machineconfig/profile/create.py +38 -26
- machineconfig/profile/create_hardlinks.py +29 -20
- machineconfig/profile/shell.py +56 -32
- machineconfig/scripts/__init__.py +0 -2
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/cloud/init.sh +2 -2
- machineconfig/scripts/linux/checkout_versions +1 -1
- machineconfig/scripts/linux/choose_wezterm_theme +1 -1
- machineconfig/scripts/linux/cloud_copy +1 -1
- machineconfig/scripts/linux/cloud_manager +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 +1 -1
- machineconfig/scripts/linux/devops +7 -7
- machineconfig/scripts/linux/fire +1 -1
- machineconfig/scripts/linux/fire_agents +3 -2
- 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/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/url2md +1 -1
- machineconfig/scripts/linux/warp-cli.sh +122 -0
- machineconfig/scripts/linux/wifi_conn +1 -1
- machineconfig/scripts/python/__pycache__/__init__.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__/fire_agents.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__init__.py +0 -0
- machineconfig/scripts/python/ai/generate_files.py +83 -0
- machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +2 -2
- machineconfig/scripts/python/ai/mcinit.py +14 -7
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +10 -5
- machineconfig/scripts/python/archive/tmate_conn.py +5 -5
- machineconfig/scripts/python/archive/tmate_start.py +7 -7
- machineconfig/scripts/python/choose_wezterm_theme.py +35 -32
- machineconfig/scripts/python/cloud_copy.py +23 -14
- machineconfig/scripts/python/cloud_mount.py +36 -24
- machineconfig/scripts/python/cloud_repo_sync.py +40 -27
- machineconfig/scripts/python/cloud_sync.py +4 -4
- machineconfig/scripts/python/croshell.py +40 -29
- machineconfig/scripts/python/devops.py +45 -27
- machineconfig/scripts/python/devops_add_identity.py +15 -25
- machineconfig/scripts/python/devops_add_ssh_key.py +8 -8
- machineconfig/scripts/python/devops_backup_retrieve.py +18 -16
- machineconfig/scripts/python/devops_devapps_install.py +25 -20
- machineconfig/scripts/python/devops_update_repos.py +232 -59
- machineconfig/scripts/python/dotfile.py +17 -15
- machineconfig/scripts/python/fire_agents.py +48 -22
- machineconfig/scripts/python/fire_jobs.py +93 -58
- machineconfig/scripts/python/ftpx.py +26 -15
- machineconfig/scripts/python/get_zellij_cmd.py +8 -7
- machineconfig/scripts/python/helpers/cloud_helpers.py +33 -28
- machineconfig/scripts/python/helpers/helpers2.py +27 -16
- machineconfig/scripts/python/helpers/helpers4.py +45 -32
- machineconfig/scripts/python/helpers/helpers5.py +1 -1
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +32 -10
- machineconfig/scripts/python/mount_nfs.py +9 -16
- machineconfig/scripts/python/mount_nw_drive.py +10 -5
- machineconfig/scripts/python/mount_ssh.py +9 -7
- machineconfig/scripts/python/repos.py +216 -58
- machineconfig/scripts/python/snapshot.py +0 -1
- machineconfig/scripts/python/start_slidev.py +11 -6
- machineconfig/scripts/python/start_terminals.py +22 -16
- machineconfig/scripts/python/viewer_template.py +0 -1
- machineconfig/scripts/python/wifi_conn.py +49 -75
- machineconfig/scripts/python/wsl_windows_transfer.py +9 -7
- machineconfig/scripts/windows/checkout_version.ps1 +1 -3
- machineconfig/scripts/windows/choose_wezterm_theme.ps1 +1 -3
- machineconfig/scripts/windows/cloud_copy.ps1 +2 -6
- machineconfig/scripts/windows/cloud_manager.ps1 +1 -1
- machineconfig/scripts/windows/cloud_repo_sync.ps1 +1 -2
- machineconfig/scripts/windows/cloud_sync.ps1 +2 -2
- machineconfig/scripts/windows/croshell.ps1 +2 -2
- machineconfig/scripts/windows/devops.ps1 +1 -4
- machineconfig/scripts/windows/dotfile.ps1 +1 -3
- machineconfig/scripts/windows/fire.ps1 +1 -1
- machineconfig/scripts/windows/ftpx.ps1 +2 -2
- machineconfig/scripts/windows/gpt.ps1 +1 -1
- machineconfig/scripts/windows/kill_process.ps1 +1 -2
- machineconfig/scripts/windows/mcinit.ps1 +1 -1
- machineconfig/scripts/windows/mount_nfs.ps1 +1 -1
- machineconfig/scripts/windows/mount_ssh.ps1 +1 -1
- machineconfig/scripts/windows/pomodoro.ps1 +1 -1
- machineconfig/scripts/windows/py2exe.ps1 +1 -3
- machineconfig/scripts/windows/repos.ps1 +1 -1
- machineconfig/scripts/windows/scheduler.ps1 +1 -1
- machineconfig/scripts/windows/snapshot.ps1 +2 -2
- machineconfig/scripts/windows/start_slidev.ps1 +1 -1
- machineconfig/scripts/windows/start_terminals.ps1 +1 -1
- machineconfig/scripts/windows/wifi_conn.ps1 +1 -1
- machineconfig/scripts/windows/wsl_windows_transfer.ps1 +1 -3
- machineconfig/settings/lf/linux/lfrc +2 -1
- machineconfig/settings/linters/.ruff_cache/.gitignore +2 -0
- machineconfig/settings/linters/.ruff_cache/CACHEDIR.TAG +1 -0
- machineconfig/settings/lvim/windows/archive/config_additional.lua +1 -1
- machineconfig/settings/svim/linux/init.toml +1 -1
- machineconfig/settings/svim/windows/init.toml +1 -1
- machineconfig/setup_linux/web_shortcuts/croshell.sh +3 -52
- machineconfig/setup_linux/web_shortcuts/interactive.sh +6 -6
- machineconfig/setup_linux/web_shortcuts/ssh.sh +0 -4
- machineconfig/setup_windows/web_shortcuts/all.ps1 +2 -2
- machineconfig/setup_windows/web_shortcuts/ascii_art.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/croshell.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +5 -5
- machineconfig/setup_windows/wt_and_pwsh/install_fonts.ps1 +51 -15
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +58 -13
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +45 -37
- machineconfig/utils/ai/generate_file_checklist.py +8 -10
- machineconfig/utils/ai/url2md.py +4 -2
- machineconfig/utils/cloud/onedrive/setup_oauth.py +1 -0
- machineconfig/utils/cloud/onedrive/transaction.py +63 -98
- machineconfig/utils/code.py +62 -41
- machineconfig/utils/installer.py +29 -35
- machineconfig/utils/installer_utils/installer_abc.py +11 -11
- machineconfig/utils/installer_utils/installer_class.py +155 -74
- machineconfig/utils/links.py +112 -31
- machineconfig/utils/notifications.py +211 -0
- machineconfig/utils/options.py +41 -42
- machineconfig/utils/path.py +13 -6
- machineconfig/utils/path_reduced.py +614 -311
- machineconfig/utils/procs.py +48 -42
- machineconfig/utils/scheduling.py +0 -1
- machineconfig/utils/source_of_truth.py +27 -0
- machineconfig/utils/ssh.py +146 -85
- machineconfig/utils/terminal.py +84 -37
- machineconfig/utils/upgrade_packages.py +91 -0
- machineconfig/utils/utils2.py +39 -50
- machineconfig/utils/utils5.py +195 -116
- machineconfig/utils/ve.py +13 -5
- {machineconfig-2.0.dist-info ā machineconfig-2.2.dist-info}/METADATA +14 -13
- {machineconfig-2.0.dist-info ā machineconfig-2.2.dist-info}/RECORD +212 -237
- machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/python_ve_symlink.cpython-311.pyc +0 -0
- machineconfig/jobs/python/archive/python_tools.txt +0 -12
- machineconfig/jobs/python/vscode/__pycache__/select_interpreter.cpython-311.pyc +0 -0
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/update.py +0 -3
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
- machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/linux/activate_ve +0 -87
- machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_backup_retrieve.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/init.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/windows/activate_ve.ps1 +0 -54
- machineconfig/setup_linux/web_shortcuts/all.sh +0 -48
- machineconfig/setup_linux/web_shortcuts/update_system.sh +0 -48
- machineconfig/utils/utils.py +0 -95
- /machineconfig/setup_linux/web_shortcuts/{tmp.sh ā android.sh} +0 -0
- {machineconfig-2.0.dist-info ā machineconfig-2.2.dist-info}/WHEEL +0 -0
- {machineconfig-2.0.dist-info ā machineconfig-2.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Installs Cloudflare WARP (warp-cli) on supported Ubuntu / Debian systems.
|
|
3
|
+
# Usage: sudo ./warp-cli.sh [--allow-unsupported] [--force-reinstall]
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
ALLOW_UNSUPPORTED=0
|
|
8
|
+
FORCE_REINSTALL=0
|
|
9
|
+
|
|
10
|
+
for arg in "$@"; do
|
|
11
|
+
case "$arg" in
|
|
12
|
+
--allow-unsupported) ALLOW_UNSUPPORTED=1 ;;
|
|
13
|
+
--force-reinstall) FORCE_REINSTALL=1 ;;
|
|
14
|
+
-h|--help)
|
|
15
|
+
printf "Usage: %s [--allow-unsupported] [--force-reinstall]\n" "$0"
|
|
16
|
+
exit 0
|
|
17
|
+
;;
|
|
18
|
+
*)
|
|
19
|
+
printf "Unknown argument: %s\n" "$arg" >&2
|
|
20
|
+
exit 2
|
|
21
|
+
;;
|
|
22
|
+
esac
|
|
23
|
+
done
|
|
24
|
+
|
|
25
|
+
require_root() {
|
|
26
|
+
if [ "${EUID}" -ne 0 ]; then
|
|
27
|
+
printf "Please run as root (use sudo).\n" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
have_cmd() { command -v "$1" >/dev/null 2>&1; }
|
|
33
|
+
|
|
34
|
+
detect_os() {
|
|
35
|
+
if have_cmd lsb_release; then
|
|
36
|
+
DIST_ID=$(lsb_release -si 2>/dev/null | tr '[:upper:]' '[:lower:]')
|
|
37
|
+
CODENAME=$(lsb_release -sc 2>/dev/null | tr '[:upper:]' '[:lower:]')
|
|
38
|
+
elif [ -f /etc/os-release ]; then
|
|
39
|
+
# shellcheck disable=SC1091
|
|
40
|
+
. /etc/os-release
|
|
41
|
+
DIST_ID=$(printf "%s" "${ID:-}" | tr '[:upper:]' '[:lower:]')
|
|
42
|
+
CODENAME=$(printf "%s" "${VERSION_CODENAME:-}" | tr '[:upper:]' '[:lower:]')
|
|
43
|
+
else
|
|
44
|
+
printf "Cannot detect distribution. Install lsb_release or provide /etc/os-release.\n" >&2
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
is_supported() {
|
|
50
|
+
case "$DIST_ID" in
|
|
51
|
+
ubuntu)
|
|
52
|
+
# Supported: noble jammy focal (older: bionic xenial)
|
|
53
|
+
case "$CODENAME" in
|
|
54
|
+
noble|jammy|focal|bionic|xenial) return 0 ;; esac ;;
|
|
55
|
+
debian)
|
|
56
|
+
# Supported: bookworm bullseye buster (older: stretch)
|
|
57
|
+
case "$CODENAME" in
|
|
58
|
+
bookworm|bullseye|buster|stretch) return 0 ;; esac ;;
|
|
59
|
+
esac
|
|
60
|
+
return 1
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
add_key() {
|
|
64
|
+
local key_path="/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg"
|
|
65
|
+
if [ -s "$key_path" ]; then
|
|
66
|
+
return 0
|
|
67
|
+
fi
|
|
68
|
+
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output "$key_path"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
add_repo() {
|
|
72
|
+
local list_file="/etc/apt/sources.list.d/cloudflare-client.list"
|
|
73
|
+
if grep -q "pkg.cloudflareclient.com" "$list_file" 2>/dev/null; then
|
|
74
|
+
return 0
|
|
75
|
+
fi
|
|
76
|
+
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ ${CODENAME} main" > "$list_file"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
need_update=0
|
|
80
|
+
install_package() {
|
|
81
|
+
if dpkg -s cloudflare-warp >/dev/null 2>&1; then
|
|
82
|
+
if [ "$FORCE_REINSTALL" -eq 1 ]; then
|
|
83
|
+
apt-get install --reinstall -y cloudflare-warp
|
|
84
|
+
else
|
|
85
|
+
printf "cloudflare-warp already installed. Use --force-reinstall to reinstall.\n"
|
|
86
|
+
fi
|
|
87
|
+
else
|
|
88
|
+
apt-get install -y cloudflare-warp
|
|
89
|
+
fi
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main() {
|
|
93
|
+
require_root
|
|
94
|
+
if ! have_cmd apt-get; then
|
|
95
|
+
printf "apt-get not found. This script supports only Debian/Ubuntu.\n" >&2
|
|
96
|
+
exit 1
|
|
97
|
+
fi
|
|
98
|
+
detect_os
|
|
99
|
+
if ! is_supported; then
|
|
100
|
+
if [ "$ALLOW_UNSUPPORTED" -ne 1 ]; then
|
|
101
|
+
printf "Distribution %s (%s) not in supported list. Use --allow-unsupported to proceed.\n" "$DIST_ID" "$CODENAME" >&2
|
|
102
|
+
exit 3
|
|
103
|
+
else
|
|
104
|
+
printf "Proceeding on unsupported distribution %s (%s).\n" "$DIST_ID" "$CODENAME"
|
|
105
|
+
fi
|
|
106
|
+
fi
|
|
107
|
+
pre_key_checksum=$( [ -f /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg ] && sha256sum /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg | cut -d' ' -f1 || true )
|
|
108
|
+
add_key
|
|
109
|
+
post_key_checksum=$(sha256sum /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg | cut -d' ' -f1)
|
|
110
|
+
if [ "$pre_key_checksum" != "$post_key_checksum" ]; then need_update=1; fi
|
|
111
|
+
repo_before=$(grep -R "pkg.cloudflareclient.com" /etc/apt/sources.list.d 2>/dev/null || true)
|
|
112
|
+
add_repo
|
|
113
|
+
repo_after=$(grep -R "pkg.cloudflareclient.com" /etc/apt/sources.list.d 2>/dev/null || true)
|
|
114
|
+
if [ "$repo_before" != "$repo_after" ]; then need_update=1; fi
|
|
115
|
+
if [ "$need_update" -eq 1 ]; then
|
|
116
|
+
apt-get update
|
|
117
|
+
fi
|
|
118
|
+
install_package
|
|
119
|
+
printf "Done. Basic usage: 'warp-cli register' then 'warp-cli connect'. For account: 'warp-cli set-mode warp'.\n"
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
main "$@"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Script to generate a markdown table with checkboxes for all Python files in the repo."""
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def get_python_files(repo_root: Path) -> list[str]:
|
|
8
|
+
"""Get all Python files relative to repo root."""
|
|
9
|
+
# Get all .py files recursively
|
|
10
|
+
py_files = list(repo_root.glob("**/*.py"))
|
|
11
|
+
|
|
12
|
+
# Filter out files in .venv and __pycache__ directories
|
|
13
|
+
filtered_files = []
|
|
14
|
+
for file_path in py_files:
|
|
15
|
+
relative_path = file_path.relative_to(repo_root)
|
|
16
|
+
path_parts = relative_path.parts
|
|
17
|
+
|
|
18
|
+
# Skip files in .venv or __pycache__ directories
|
|
19
|
+
if any(part in {".venv", "__pycache__"} for part in path_parts):
|
|
20
|
+
continue
|
|
21
|
+
|
|
22
|
+
filtered_files.append(str(relative_path))
|
|
23
|
+
|
|
24
|
+
return sorted(filtered_files)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def generate_markdown_table(files: list[str]) -> str:
|
|
28
|
+
"""Generate markdown table with checkboxes."""
|
|
29
|
+
header = "# Python Files Checklist\n\n"
|
|
30
|
+
table = "| Index | File Path | Status |\n|-------|-----------|--------|\n"
|
|
31
|
+
|
|
32
|
+
for index, file_path in enumerate(files, start=1):
|
|
33
|
+
# Remove leading ./ if present
|
|
34
|
+
clean_path = file_path.lstrip("./")
|
|
35
|
+
table += f"| {index} | {clean_path} | - [ ] |\n"
|
|
36
|
+
|
|
37
|
+
return header + table
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def main() -> None:
|
|
41
|
+
"""Main function."""
|
|
42
|
+
repo_root = Path.cwd()
|
|
43
|
+
if not repo_root.joinpath("pyproject.toml").exists():
|
|
44
|
+
raise RuntimeError(f" {repo_root} Not a repo root")
|
|
45
|
+
output_file = repo_root / ".ai" / "all_files_with_index.md"
|
|
46
|
+
|
|
47
|
+
print(f"Repo root: {repo_root}")
|
|
48
|
+
print(f"Output file: {output_file}")
|
|
49
|
+
|
|
50
|
+
# Ensure output directory exists
|
|
51
|
+
output_file.parent.mkdir(parents=True, exist_ok=True)
|
|
52
|
+
|
|
53
|
+
# Get Python files
|
|
54
|
+
python_files = get_python_files(repo_root)
|
|
55
|
+
print(f"Found {len(python_files)} Python files")
|
|
56
|
+
|
|
57
|
+
# Generate markdown
|
|
58
|
+
markdown_content = generate_markdown_table(python_files)
|
|
59
|
+
print(f"Generated markdown content length: {len(markdown_content)}")
|
|
60
|
+
|
|
61
|
+
# Write to file
|
|
62
|
+
output_file.write_text(markdown_content)
|
|
63
|
+
print(f"Generated {output_file} with {len(python_files)} Python files")
|
|
64
|
+
|
|
65
|
+
# Create 5 symlinks to repo_root at ~/code_copies/${repo_name}_copy_{i}
|
|
66
|
+
import pathlib
|
|
67
|
+
|
|
68
|
+
# import os
|
|
69
|
+
repo_root = pathlib.Path.cwd().resolve()
|
|
70
|
+
repo_name: str = pathlib.Path(repo_root).name
|
|
71
|
+
symlink_dir: pathlib.Path = pathlib.Path.home() / "code_copies"
|
|
72
|
+
symlink_dir.mkdir(exist_ok=True)
|
|
73
|
+
for i in range(1, 6):
|
|
74
|
+
symlink_path: pathlib.Path = symlink_dir / f"{repo_name}_copy_{i}"
|
|
75
|
+
if symlink_path.exists() or symlink_path.is_symlink():
|
|
76
|
+
symlink_path.unlink()
|
|
77
|
+
symlink_path.symlink_to(repo_root, target_is_directory=True)
|
|
78
|
+
# Windows equivalent (comment):
|
|
79
|
+
# for /l %i in (1,1,5) do mklink /D "%USERPROFILE%\code_copies\{repo_name}_copy_%i" "C:\path\to\repo_root"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
main()
|
|
@@ -34,12 +34,12 @@ applyTo: "**/*.py"
|
|
|
34
34
|
* when finished, run a linting static analysis check against files you touched, Any fix any mistakes.
|
|
35
35
|
* Please run `uv run -m pyright $file_touched` and address all issues. if `pyright is not there, first run `uv add pyright --dev`.
|
|
36
36
|
* For all type checkers and linters, like mypy, pyright, pyrefly and pylint, there are config files at different levels of the repo all the way up to home directory level. You don't need to worry about them, just be mindful that they exist. The tools themselves will respect the configs therein.
|
|
37
|
-
* If you want to run all linters and pycheckers agains the entire project to make sure everything is clean, I prepared a nice shell script, you can run it from the repo root as
|
|
37
|
+
* If you want to run all linters and pycheckers agains the entire project to make sure everything is clean, I prepared a nice shell script, you can run it from the repo root as `./.scripts/lint_and_typecheck.sh`. It will produce markdown files that are you are meant to look at @ ./.linters/*.md
|
|
38
38
|
|
|
39
39
|
# General Programming Ethos:
|
|
40
40
|
* Make sure all the code is rigorous, no lazy stuff.
|
|
41
41
|
* For example, always avoid default values in arguments of functions. Those are evil and cause confusion. Always be explicit in parameter passing.
|
|
42
|
-
*
|
|
42
|
+
* Please never ever attempt to change code files by writing meta code to do string manipulation on files, e.g. with `sed` command with terminal. Please do change the files one by one, no matter how many there is. Don't worry about time, nor context window size, its okay, take your time and do the legwork. You can stop in the middle and we will have another LLM to help with the rest.
|
|
43
43
|
* Please avoid writing README files and avoid docstring and comments in code unless absolutely necessary. Use clear naming conventions instead of documenting.
|
|
44
44
|
* Always prefer to functional style of programming over OOP.
|
|
45
45
|
* When passing arguments or constructing dicts or lists or tuples, avoid breaking lines too much, try to use ~ 150 characters per line before breaking to new one.
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
from pathlib import Path
|
|
4
2
|
from typing import Optional
|
|
5
3
|
|
|
@@ -9,8 +7,10 @@ uv add --upgrade-package pylint pyright mypy pyrefly ty --dev # linters and typ
|
|
|
9
7
|
uv add --upgrade-package pytest --dev
|
|
10
8
|
"""
|
|
11
9
|
|
|
10
|
+
|
|
12
11
|
def get_repo_root(path: Path) -> Optional[Path]:
|
|
13
12
|
from git import Repo, InvalidGitRepositoryError
|
|
13
|
+
|
|
14
14
|
try:
|
|
15
15
|
repo = Repo(path, search_parent_directories=True)
|
|
16
16
|
root = repo.working_tree_dir
|
|
@@ -20,12 +20,15 @@ def get_repo_root(path: Path) -> Optional[Path]:
|
|
|
20
20
|
pass
|
|
21
21
|
return None
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
def add_ai_configs(repo_root: Path):
|
|
24
25
|
import machineconfig as mc
|
|
26
|
+
|
|
25
27
|
mc_root = Path(mc.__file__).parent
|
|
26
28
|
|
|
27
29
|
repo_root_resolved = get_repo_root(repo_root)
|
|
28
|
-
if repo_root_resolved is not None:
|
|
30
|
+
if repo_root_resolved is not None:
|
|
31
|
+
repo_root = repo_root_resolved # this means you can run the command from any subdirectory of the repo.
|
|
29
32
|
|
|
30
33
|
if repo_root.joinpath("pyproject.toml").exists() is False:
|
|
31
34
|
uv_init = input(f"{repo_root} does not seem to be a python project (no pyproject.toml found), would you like to initialize one? (y/n) ")
|
|
@@ -35,6 +38,7 @@ uv init --python 3.13
|
|
|
35
38
|
uv venv
|
|
36
39
|
"""
|
|
37
40
|
import subprocess
|
|
41
|
+
|
|
38
42
|
subprocess.run(command_to_run, shell=True, check=True)
|
|
39
43
|
else:
|
|
40
44
|
print("Terminating mcinit ...")
|
|
@@ -77,11 +81,15 @@ uv venv
|
|
|
77
81
|
repo_root.joinpath(".gemini").mkdir(parents=True, exist_ok=True)
|
|
78
82
|
repo_root.joinpath(".gemini/settings.json").write_text(data=gemini_settings.read_text(encoding="utf-8"), encoding="utf-8")
|
|
79
83
|
|
|
84
|
+
tmp = repo_root.joinpath(".clinerules")
|
|
85
|
+
tmp.mkdir(parents=True, exist_ok=True)
|
|
86
|
+
tmp.joinpath("python_dev.md").write_text(data=generic_instructions.read_text(encoding="utf-8"), encoding="utf-8")
|
|
87
|
+
|
|
80
88
|
# OTHERS
|
|
81
89
|
scripts_dir = mc_root.joinpath("scripts/python/ai/scripts")
|
|
82
|
-
repo_root.joinpath("scripts").mkdir(parents=True, exist_ok=True)
|
|
90
|
+
repo_root.joinpath(".scripts").mkdir(parents=True, exist_ok=True)
|
|
83
91
|
for a_script in scripts_dir.iterdir():
|
|
84
|
-
repo_root.joinpath("scripts", a_script.name).write_text(data=a_script.read_text(encoding="utf-8"), encoding="utf-8")
|
|
92
|
+
repo_root.joinpath(".scripts", a_script.name).write_text(data=a_script.read_text(encoding="utf-8"), encoding="utf-8")
|
|
85
93
|
|
|
86
94
|
dot_ai_dir = repo_root.joinpath(".ai")
|
|
87
95
|
dot_ai_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -89,8 +97,7 @@ uv venv
|
|
|
89
97
|
if dot_git_ignore_path.exists():
|
|
90
98
|
dot_git_ignore_content = dot_git_ignore_path.read_text(encoding="utf-8")
|
|
91
99
|
to_add: list[str] = []
|
|
92
|
-
to_check_for: list[str] = [".links", "notebooks", ".ai", "scripts",
|
|
93
|
-
"GEMINI.md", "CLAUDE.md", ".cursor", ".github"]
|
|
100
|
+
to_check_for: list[str] = [".links", "notebooks", ".ai", ".scripts", "GEMINI.md", "CLAUDE.md", ".cursor", ".github"]
|
|
94
101
|
for item in to_check_for:
|
|
95
102
|
if item not in dot_git_ignore_content:
|
|
96
103
|
to_add.append(item)
|
|
@@ -8,18 +8,23 @@ fi
|
|
|
8
8
|
echo "Running linting and type checking..."
|
|
9
9
|
|
|
10
10
|
echo "Setting up environment..."
|
|
11
|
-
uv add pylint pyright mypy pyrefly ruff ty --dev # linters and type checkers
|
|
12
|
-
uv add cleanpy --
|
|
11
|
+
# uv add pylint pyright mypy pyrefly ruff ty --dev # linters and type checkers
|
|
12
|
+
# uv add --dev cleanpy pylint pyright mypy pyrefly --upgrade-package cleanpy pylint pyright mypy pyrefly
|
|
13
|
+
uv add --dev pyright --upgrade-package pyright
|
|
14
|
+
uv add --dev pylint --upgrade-package pylint
|
|
15
|
+
uv add --dev mypy --upgrade-package mypy
|
|
16
|
+
uv add --dev pyrefly --upgrade-package pyrefly
|
|
17
|
+
uv add --dev cleanpy --upgrade-package cleanpy
|
|
18
|
+
|
|
13
19
|
|
|
14
20
|
uv add types-requests types-toml types-PyYAML types-pytz types-paramiko types-urllib3 --dev
|
|
15
21
|
uv add types-mysqlclient types-SQLAlchemy --dev
|
|
16
|
-
uv add types-pytest-lazy-fixtures --dev
|
|
17
22
|
|
|
18
23
|
uv run -m cleanpy .
|
|
19
24
|
uv run -m ruff clean
|
|
20
|
-
uv run -m ruff format .
|
|
25
|
+
# uv run -m ruff format .
|
|
21
26
|
uv run -m ruff check . --fix
|
|
22
|
-
|
|
27
|
+
uv run --with machineconfig -m machineconfig.scripts.python.ai.generate_files
|
|
23
28
|
|
|
24
29
|
mkdir .linters
|
|
25
30
|
|
|
@@ -13,16 +13,16 @@ console = Console()
|
|
|
13
13
|
|
|
14
14
|
def get_conn_string(sess_name: str) -> str:
|
|
15
15
|
creds = configparser.ConfigParser()
|
|
16
|
-
creds.read(Path.home().joinpath(
|
|
17
|
-
sess_name = creds[
|
|
18
|
-
user_name = creds[
|
|
16
|
+
creds.read(Path.home().joinpath("dotfiles/creds/tmate/creds.ini"))
|
|
17
|
+
sess_name = creds["sessions_names"][sess_name]
|
|
18
|
+
user_name = creds["keys"]["username"]
|
|
19
19
|
return f"{user_name}/{sess_name}@sgp1.tmate.io"
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def main():
|
|
23
23
|
console.print(Panel("š Tmate Connection Manager", title="[bold]Welcome[/bold]"))
|
|
24
24
|
|
|
25
|
-
parser = argparse.ArgumentParser(description=
|
|
25
|
+
parser = argparse.ArgumentParser(description="Tmate launcher")
|
|
26
26
|
parser.add_argument("sess_name", help="session name", default=random.choices(list(string.digits + string.ascii_letters), k=20))
|
|
27
27
|
args = parser.parse_args()
|
|
28
28
|
|
|
@@ -37,5 +37,5 @@ def main():
|
|
|
37
37
|
console.print("ā
Connection closed")
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
if __name__ ==
|
|
40
|
+
if __name__ == "__main__":
|
|
41
41
|
main()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"""Tmate
|
|
2
|
-
|
|
1
|
+
"""Tmate"""
|
|
2
|
+
|
|
3
3
|
import argparse
|
|
4
4
|
import configparser
|
|
5
5
|
from pathlib import Path
|
|
@@ -17,10 +17,10 @@ def main():
|
|
|
17
17
|
|
|
18
18
|
console.print("[bold yellow]Loading credentials...[/bold yellow]")
|
|
19
19
|
creds = configparser.ConfigParser()
|
|
20
|
-
creds.read(Path.home().joinpath(
|
|
20
|
+
creds.read(Path.home().joinpath("dotfiles/creds/tmate/creds.ini"))
|
|
21
21
|
console.print("[green]Credentials loaded[/green]")
|
|
22
22
|
|
|
23
|
-
parser = argparse.ArgumentParser(description=
|
|
23
|
+
parser = argparse.ArgumentParser(description="Tmate launcher")
|
|
24
24
|
random_sess = random.choices(list(string.digits + string.ascii_letters), k=20)
|
|
25
25
|
_ = random_sess
|
|
26
26
|
parser.add_argument("sess_name", help="session name (new only with random string will be chosen if not passed)", default=None)
|
|
@@ -28,8 +28,8 @@ def main():
|
|
|
28
28
|
args = parser.parse_args()
|
|
29
29
|
|
|
30
30
|
console.print(f"š Looking up session configuration: {args.sess_name}")
|
|
31
|
-
sess_name = creds[
|
|
32
|
-
api_key = creds[
|
|
31
|
+
sess_name = creds["sessions_names"][args.sess_name]
|
|
32
|
+
api_key = creds["keys"]["api_key"]
|
|
33
33
|
|
|
34
34
|
console.print(Panel(f"š Starting tmate session: {sess_name}", title="[bold green]Session Info[/bold green]"))
|
|
35
35
|
|
|
@@ -40,5 +40,5 @@ def main():
|
|
|
40
40
|
console.print("[green]Tmate session ended[/green]")
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
if __name__ ==
|
|
43
|
+
if __name__ == "__main__":
|
|
44
44
|
main()
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Choose a theme for Wezterm
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from machineconfig.utils.
|
|
5
|
+
from machineconfig.utils.options import choose_one_option
|
|
6
|
+
from machineconfig.utils.path_reduced import PathExtended
|
|
6
7
|
from typing import Any
|
|
7
8
|
import time
|
|
8
9
|
from rich.panel import Panel
|
|
@@ -13,32 +14,32 @@ console = Console()
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
schemes_list = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
17
|
+
"Pro",
|
|
18
|
+
"Spiderman",
|
|
19
|
+
"shades-of-purple",
|
|
20
|
+
"synthwave",
|
|
21
|
+
"Symfonic",
|
|
22
|
+
"PaulMillr",
|
|
23
|
+
"Neon",
|
|
24
|
+
"LiquidCarbonTransparentInverse",
|
|
25
|
+
"Laser",
|
|
26
|
+
"IR_Black",
|
|
27
|
+
"Hurtado",
|
|
28
|
+
"Homebrew",
|
|
29
|
+
"Hipster Green",
|
|
30
|
+
"Firefly Traditional",
|
|
31
|
+
"Elementary",
|
|
32
|
+
"deep",
|
|
33
|
+
"Dark Pastel",
|
|
34
|
+
"Bright Lights",
|
|
35
|
+
"Adventure",
|
|
36
|
+
"Nancy (terminal.sexy)",
|
|
37
|
+
"Bim (Gogh)",
|
|
38
|
+
"BlueDolphin",
|
|
39
|
+
"Borland",
|
|
40
|
+
"Grass (Gogh)",
|
|
41
|
+
"Greenscreen (light) (terminal.sexy)",
|
|
42
|
+
"Grayscale (dark) (terminal.sexy)",
|
|
42
43
|
]
|
|
43
44
|
|
|
44
45
|
|
|
@@ -54,10 +55,11 @@ def set_theme(theme: str):
|
|
|
54
55
|
txt_lines = PathExtended("~/.config/wezterm/wezterm.lua").expanduser().read_text(encoding="utf-8").splitlines()
|
|
55
56
|
res_lines = []
|
|
56
57
|
for line in txt_lines:
|
|
57
|
-
if
|
|
58
|
+
if "config.color_scheme = " in line:
|
|
58
59
|
res_lines.append(f"config.color_scheme = '{theme}'")
|
|
59
|
-
else:
|
|
60
|
-
|
|
60
|
+
else:
|
|
61
|
+
res_lines.append(line)
|
|
62
|
+
PathExtended("~/.config/wezterm/wezterm.lua").expanduser().write_text("\n".join(res_lines), encoding="utf-8")
|
|
61
63
|
time.sleep(0.1)
|
|
62
64
|
print("š¾ Configuration saved")
|
|
63
65
|
|
|
@@ -70,6 +72,7 @@ def main():
|
|
|
70
72
|
curses.wrapper(accessory)
|
|
71
73
|
console.print(Panel("ā
Theme selection completed", title_align="left", border_style="green"))
|
|
72
74
|
|
|
75
|
+
|
|
73
76
|
def accessory(stdscr: Any):
|
|
74
77
|
options = schemes_list
|
|
75
78
|
current_option = 0
|
|
@@ -90,7 +93,7 @@ def accessory(stdscr: Any):
|
|
|
90
93
|
stdscr.addstr(i, 0, f" {option}")
|
|
91
94
|
|
|
92
95
|
# Display status line
|
|
93
|
-
status_line = f"š Theme {current_option+1}/{len(options)} | ā/ā: Navigate | Enter: Select"
|
|
96
|
+
status_line = f"š Theme {current_option + 1}/{len(options)} | ā/ā: Navigate | Enter: Select"
|
|
94
97
|
stdscr.addstr(page_size, 0, status_line)
|
|
95
98
|
|
|
96
99
|
# Get key press
|
|
@@ -101,6 +104,6 @@ def accessory(stdscr: Any):
|
|
|
101
104
|
current_option -= 1
|
|
102
105
|
elif key == curses.KEY_DOWN and current_option < len(options) - 1:
|
|
103
106
|
current_option += 1
|
|
104
|
-
elif key == ord(
|
|
107
|
+
elif key == ord("\n"): # Enter key
|
|
105
108
|
break # Exit the loop
|
|
106
109
|
set_theme(options[current_option])
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
CC
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from machineconfig.utils.path_reduced import
|
|
5
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
6
6
|
from tenacity import retry, stop_after_attempt, wait_chain, wait_fixed
|
|
7
7
|
import getpass
|
|
8
8
|
import argparse
|
|
@@ -18,6 +18,7 @@ from machineconfig.utils.utils2 import pprint
|
|
|
18
18
|
|
|
19
19
|
console = Console()
|
|
20
20
|
|
|
21
|
+
|
|
21
22
|
@retry(stop=stop_after_attempt(3), wait=wait_chain(wait_fixed(1), wait_fixed(4), wait_fixed(9)))
|
|
22
23
|
def get_securely_shared_file(url: Optional[str] = None, folder: Optional[str] = None) -> None:
|
|
23
24
|
console.print(Panel("š Secure File Downloader", title="[bold blue]Downloader[/bold blue]", border_style="blue"))
|
|
@@ -63,7 +64,7 @@ def get_securely_shared_file(url: Optional[str] = None, folder: Optional[str] =
|
|
|
63
64
|
def arg_parser() -> None:
|
|
64
65
|
console.print(Panel("āļø Cloud Copy Utility", title="[bold blue]Cloud Copy[/bold blue]", border_style="blue", width=152))
|
|
65
66
|
|
|
66
|
-
parser = argparse.ArgumentParser(description=
|
|
67
|
+
parser = argparse.ArgumentParser(description="š Cloud CLI. It wraps rclone with sane defaults for optimum type time.")
|
|
67
68
|
|
|
68
69
|
# positional argument
|
|
69
70
|
parser.add_argument("source", help="š file/folder path to be taken from here.")
|
|
@@ -80,7 +81,7 @@ def arg_parser() -> None:
|
|
|
80
81
|
parser.add_argument("--zip", "-z", help="š¦ unzip after receiving.", action="store_true", default=ArgsDefaults.zip_)
|
|
81
82
|
parser.add_argument("--os_specific", "-o", help="š» choose path specific for this OS.", action="store_true", default=ArgsDefaults.os_specific)
|
|
82
83
|
|
|
83
|
-
parser.add_argument("--config", "-c",
|
|
84
|
+
parser.add_argument("--config", "-c", help="āļø path to cloud.json file.", default=None)
|
|
84
85
|
|
|
85
86
|
args = parser.parse_args()
|
|
86
87
|
args_dict = vars(args)
|
|
@@ -117,26 +118,34 @@ def arg_parser() -> None:
|
|
|
117
118
|
if cloud in source:
|
|
118
119
|
console.print(Panel(f"š„ DOWNLOADING FROM CLOUD\nāļø Cloud: {cloud}\nš Source: {source.replace(cloud + ':', '')}\nšÆ Target: {target}", title="[bold blue]Download[/bold blue]", border_style="blue", width=152))
|
|
119
120
|
|
|
120
|
-
PathExtended(target).from_cloud(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
PathExtended(target).from_cloud(
|
|
122
|
+
cloud=cloud,
|
|
123
|
+
remotepath=source.replace(cloud + ":", ""),
|
|
124
|
+
unzip=args_obj.zip,
|
|
125
|
+
decrypt=args_obj.encrypt,
|
|
126
|
+
pwd=args_obj.pwd,
|
|
127
|
+
overwrite=args_obj.overwrite,
|
|
128
|
+
rel2home=args_obj.rel2home,
|
|
129
|
+
os_specific=args_obj.os_specific,
|
|
130
|
+
root=args_obj.root,
|
|
131
|
+
strict=False,
|
|
132
|
+
)
|
|
125
133
|
console.print(Panel("ā
Download completed successfully", title="[bold green]Success[/bold green]", border_style="green", width=152))
|
|
126
134
|
|
|
127
135
|
elif cloud in target:
|
|
128
136
|
console.print(Panel(f"š¤ UPLOADING TO CLOUD\nāļø Cloud: {cloud}\nš Source: {source}\nšÆ Target: {target.replace(cloud + ':', '')}", title="[bold blue]Upload[/bold blue]", border_style="blue", width=152))
|
|
129
137
|
|
|
130
|
-
res = PathExtended(source).to_cloud(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
share=args_obj.share)
|
|
138
|
+
res = PathExtended(source).to_cloud(
|
|
139
|
+
cloud=cloud, remotepath=target.replace(cloud + ":", ""), zip=args_obj.zip, encrypt=args_obj.encrypt, pwd=args_obj.pwd, rel2home=args_obj.rel2home, root=args_obj.root, os_specific=args_obj.os_specific, strict=False, share=args_obj.share
|
|
140
|
+
)
|
|
134
141
|
console.print(Panel("ā
Upload completed successfully", title="[bold green]Success[/bold green]", border_style="green", width=152))
|
|
135
142
|
|
|
136
143
|
if args_obj.share:
|
|
137
144
|
fname = f".share_url_{cloud}"
|
|
138
|
-
if PathExtended(source).is_dir():
|
|
139
|
-
|
|
145
|
+
if PathExtended(source).is_dir():
|
|
146
|
+
share_url_path = PathExtended(source).joinpath(fname)
|
|
147
|
+
else:
|
|
148
|
+
share_url_path = PathExtended(source).with_suffix(fname)
|
|
140
149
|
share_url_path.write_text(res.as_url_str(), encoding="utf-8")
|
|
141
150
|
console.print(Panel(f"š SHARE URL GENERATED\nš URL file: {share_url_path}\nš {res.as_url_str()}", title="[bold blue]Share[/bold blue]", border_style="blue", width=152))
|
|
142
151
|
else:
|