machineconfig 1.8__py3-none-any.whl → 1.9__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/__init__.py +4 -2
- machineconfig/jobs/python/check_installations.py +1 -1
- machineconfig/jobs/python_custom_installers/azuredatastudio.py +36 -0
- machineconfig/jobs/{script_installer → python_custom_installers}/bypass_paywall.py +8 -1
- machineconfig/jobs/{script_installer → python_custom_installers}/docker_desktop.py +14 -3
- machineconfig/jobs/python_custom_installers/gh.py +53 -0
- machineconfig/jobs/python_custom_installers/goes.py +35 -0
- machineconfig/jobs/python_custom_installers/helix.py +43 -0
- machineconfig/jobs/python_custom_installers/lvim.py +48 -0
- machineconfig/jobs/{script_installer → python_custom_installers}/ngrok.py +11 -1
- machineconfig/jobs/python_custom_installers/nvim.py +48 -0
- machineconfig/jobs/{script_installer/code.py → python_custom_installers/vscode.py} +11 -0
- machineconfig/jobs/python_custom_installers/wezterm.py +41 -0
- machineconfig/profile/create.py +4 -1
- machineconfig/scripts/python/choose_wezterm_theme.py +96 -0
- machineconfig/scripts/python/cloud_copy.py +5 -1
- machineconfig/scripts/python/cloud_mount.py +20 -10
- machineconfig/scripts/python/cloud_repo_sync.py +30 -22
- machineconfig/scripts/python/cloud_sync.py +4 -6
- machineconfig/scripts/python/croshell.py +17 -8
- machineconfig/scripts/python/devops_devapps_install.py +12 -6
- machineconfig/scripts/python/fire_jobs.py +92 -53
- machineconfig/scripts/python/ftpx.py +17 -7
- machineconfig/scripts/python/repos.py +5 -1
- machineconfig/scripts/python/start_terminals.py +1 -1
- machineconfig/utils/installer.py +98 -30
- machineconfig/utils/utils.py +6 -4
- machineconfig/utils/ve.py +37 -16
- machineconfig-1.9.dist-info/LICENSE +201 -0
- {machineconfig-1.8.dist-info → machineconfig-1.9.dist-info}/METADATA +155 -140
- {machineconfig-1.8.dist-info → machineconfig-1.9.dist-info}/RECORD +34 -28
- {machineconfig-1.8.dist-info → machineconfig-1.9.dist-info}/WHEEL +1 -1
- machineconfig/jobs/script_installer/azure_data_studio.py +0 -22
- machineconfig/jobs/script_installer/skim.py +0 -21
- machineconfig/jobs/script_installer/wezterm.py +0 -34
- /machineconfig/jobs/{script_installer → python_custom_installers}/__init__.py +0 -0
- {machineconfig-1.8.dist-info → machineconfig-1.9.dist-info}/top_level.txt +0 -0
machineconfig/__init__.py
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
"""
|
|
3
|
+
custom installer for azuredatastudio
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Optional
|
|
7
|
+
import platform
|
|
8
|
+
|
|
9
|
+
config_dict = {
|
|
10
|
+
"repo_url": "CUSTOM",
|
|
11
|
+
"doc": "Azure Data Studio is a data management tool that enables working with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.",
|
|
12
|
+
"filename_template_windows_amd_64": "AzureDataStudio-{}.exe",
|
|
13
|
+
"filename_template_linux_amd_64": "azuredatastudio-{}.deb",
|
|
14
|
+
"strip_v": True,
|
|
15
|
+
"exe_name": "azuredatastudio"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main(version: Optional[str] = None):
|
|
20
|
+
_ = version
|
|
21
|
+
if platform.system() == "Linux": return f"""
|
|
22
|
+
|
|
23
|
+
cd ~/Downloads
|
|
24
|
+
curl https://azuredatastudio-update.azurewebsites.net/latest/linux-x64/stable -o ./azuredatastudio-linux-x64.tar.gz
|
|
25
|
+
tar -xvf ./azuredatastudio-linux-x64.tar.gz
|
|
26
|
+
echo 'export PATH="$PATH:~/azuredatastudio-linux-x64"' >> ~/.bashrc
|
|
27
|
+
source ~/.bashrc
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
elif platform.system() == "Windows": return "winget install -e --id Microsoft.AzureDataStudio"
|
|
31
|
+
else:
|
|
32
|
+
raise NotImplementedError(f"Your platform {platform.system()} is not supported!")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == '__main__':
|
|
36
|
+
pass
|
|
@@ -7,7 +7,14 @@ from typing import Optional
|
|
|
7
7
|
from crocodile.file_management import P
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
config_dict = {
|
|
11
|
+
"repo_url": "CUSTOM",
|
|
12
|
+
"doc": """Plugin for chrome to bypass paywalls""",
|
|
13
|
+
"filename_template_windows_amd_64": "VSCodeSetup-{}.exe",
|
|
14
|
+
"filename_template_linux_amd_64": "code_{}.deb",
|
|
15
|
+
"strip_v": True,
|
|
16
|
+
"exe_name": "code"
|
|
17
|
+
}
|
|
11
18
|
|
|
12
19
|
|
|
13
20
|
def main(version: Optional[str] = None):
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
|
+
"""
|
|
3
|
+
Installer
|
|
4
|
+
"""
|
|
2
5
|
# from machineconfig.utils.installer import get_latest_release
|
|
3
|
-
#
|
|
4
6
|
# from crocodile.meta import Terminal
|
|
5
7
|
from typing import Optional
|
|
6
8
|
|
|
@@ -11,10 +13,19 @@ from typing import Optional
|
|
|
11
13
|
|
|
12
14
|
# url = r"https://github.com/koute/bytehound"
|
|
13
15
|
# fname = r"bytehound-x86_64-unknown-linux-gnu.tgz"
|
|
14
|
-
__doc__ = """Docker Desltop for Ubuntu as per https://docs.docker.com/desktop/install/ubuntu/"""
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
config_dict = {
|
|
19
|
+
"repo_url": "CUSTOM",
|
|
20
|
+
"doc": """Docker Desltop for Ubuntu as per https://docs.docker.com/desktop/install/ubuntu/""",
|
|
21
|
+
"filename_template_windows_amd_64": "gh_{}_windows_amd64.zip",
|
|
22
|
+
"filename_template_linux_amd_64": "gh_{}_linux_amd64.tar.gz",
|
|
23
|
+
"strip_v": True,
|
|
24
|
+
"exe_name": "gh"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def main(version: Optional[str]):
|
|
18
29
|
_ = version
|
|
19
30
|
code = """
|
|
20
31
|
# Add Docker's official GPG key:
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
"""gh-cli installer
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import platform
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from machineconfig.utils.installer import Installer
|
|
8
|
+
from crocodile.meta import Terminal
|
|
9
|
+
|
|
10
|
+
r"""
|
|
11
|
+
https://github.com/cli/cli
|
|
12
|
+
|
|
13
|
+
# as per https://docs.github.com/en/copilot/github-copilot-in-the-cli/using-github-copilot-in-the-cli
|
|
14
|
+
# gh auth login
|
|
15
|
+
# gh extension install github/gh-copilot
|
|
16
|
+
|
|
17
|
+
# & 'C:\Program Files\GitHub CLI\gh.exe' extension install github/gh-copilot
|
|
18
|
+
# & 'C:\Program Files\GitHub CLI\gh.exe' extension install auth login
|
|
19
|
+
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
config_dict = {
|
|
23
|
+
"repo_url": "https://github.com/cli/cli",
|
|
24
|
+
"doc": "GitHub CLI",
|
|
25
|
+
"filename_template_windows_amd_64": "gh_{}_windows_amd64.zip",
|
|
26
|
+
"filename_template_linux_amd_64": "gh_{}_linux_amd64.tar.gz",
|
|
27
|
+
"strip_v": True,
|
|
28
|
+
"exe_name": "gh"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def main(version: Optional[str]):
|
|
33
|
+
_ = version
|
|
34
|
+
inst = Installer.from_dict(d=config_dict, name="gh")
|
|
35
|
+
inst.install(version=version)
|
|
36
|
+
if platform.system() == "Windows":
|
|
37
|
+
program = "gh extension install github/gh-copilot"
|
|
38
|
+
elif platform.system() == "Linux":
|
|
39
|
+
program = """
|
|
40
|
+
gh extension install github/gh-copilot
|
|
41
|
+
"""
|
|
42
|
+
else:
|
|
43
|
+
raise NotImplementedError("unsupported platform")
|
|
44
|
+
|
|
45
|
+
program += """
|
|
46
|
+
gh auth login --with-token $HOME/dotfiles/creds/git/gh_token.txt
|
|
47
|
+
"""
|
|
48
|
+
Terminal().run(program, shell="default").print(desc="installing gh-copilot extension", capture=True)
|
|
49
|
+
return program
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
if __name__ == "__main__":
|
|
53
|
+
pass
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
"""
|
|
3
|
+
natural language to API
|
|
4
|
+
https://github.com/ShishirPatil/gorilla
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from machineconfig.utils.ve import get_ve_install_script
|
|
8
|
+
# import subprocess
|
|
9
|
+
|
|
10
|
+
config_dict = {
|
|
11
|
+
"repo_url": "CUSTOM",
|
|
12
|
+
"doc": "natural language to API",
|
|
13
|
+
"filename_template_windows_amd_64": "ngrok-stable-windows-amd64.zip",
|
|
14
|
+
"filename_template_linux_amd_64": "ngrok-stable-linux-amd64.zip",
|
|
15
|
+
"strip_v": False,
|
|
16
|
+
"exe_name": "ngrok"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
ve_name = "goex"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def main():
|
|
23
|
+
install_script = get_ve_install_script(ve_name=ve_name, py_version="3.11", install_crocodile_and_machineconfig=False,
|
|
24
|
+
delete_if_exists=True, system=None)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
install_script += f"""
|
|
28
|
+
|
|
29
|
+
. activate_ve {ve_name}
|
|
30
|
+
cd ~/code/foreign
|
|
31
|
+
git clone https://github.com/ShishirPatil/gorilla --depth 1
|
|
32
|
+
cd gorilla/goex
|
|
33
|
+
pip install -e .
|
|
34
|
+
|
|
35
|
+
"""
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
"""
|
|
3
|
+
Installers do not add runtime files to the machine, hence this script.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# from pathlib import Path
|
|
7
|
+
from machineconfig.utils.installer import Installer, LINUX_INSTALL_PATH, WINDOWS_INSTALL_PATH
|
|
8
|
+
from typing import Optional
|
|
9
|
+
import platform
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
config_dict = {
|
|
13
|
+
"repo_url": "https://github.com/helix-editor/helix",
|
|
14
|
+
"doc": "Helix is a post-modern modal text editor.",
|
|
15
|
+
"filename_template_windows_amd_64": "helix-{}-x86_64-windows.zip",
|
|
16
|
+
"filename_template_linux_amd_64": "helix-{}-x86_64-linux.tar.xz",
|
|
17
|
+
"strip_v": False,
|
|
18
|
+
"exe_name": "hx"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def main(version: Optional[str]):
|
|
23
|
+
inst = Installer.from_dict(d=config_dict, name="hx")
|
|
24
|
+
downloaded, _version_to_be_installed = inst.download(version=version)
|
|
25
|
+
hx_file_search = downloaded.search("hx", folders=False, files=True, r=True)
|
|
26
|
+
assert len(hx_file_search) == 1
|
|
27
|
+
hx_file = hx_file_search.list[0]
|
|
28
|
+
contrib = hx_file.parent / "contrib"
|
|
29
|
+
runtime = contrib.parent / "runtime"
|
|
30
|
+
assert runtime.exists()
|
|
31
|
+
assert contrib.exists()
|
|
32
|
+
if platform.system() == "Linux":
|
|
33
|
+
hx_file.move(folder=LINUX_INSTALL_PATH)
|
|
34
|
+
contrib.move(folder="~/.config/helix")
|
|
35
|
+
runtime.move(folder="~/.config/helix")
|
|
36
|
+
elif platform.system() == "Windows":
|
|
37
|
+
hx_file.move(folder=WINDOWS_INSTALL_PATH)
|
|
38
|
+
contrib.move(folder="~/.config/helix")
|
|
39
|
+
runtime.move(folder="~/.config/helix")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
main(version=None)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
"""lvim
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from crocodile.meta import Terminal
|
|
6
|
+
import subprocess
|
|
7
|
+
import platform
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
_ = Terminal, subprocess
|
|
12
|
+
# as per https://www.lunarvim.org/docs/installation
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
config_dict = {
|
|
16
|
+
"repo_url": "CUSTOM",
|
|
17
|
+
"doc": "Terminal text editor based on neovim.",
|
|
18
|
+
"filename_template_windows_amd_64": "",
|
|
19
|
+
"filename_template_linux_amd_64": "",
|
|
20
|
+
"strip_v": False,
|
|
21
|
+
"exe_name": "lvim"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def main(version: Optional[str]):
|
|
26
|
+
_ = version
|
|
27
|
+
if platform.system() == "Windows":
|
|
28
|
+
program = """
|
|
29
|
+
|
|
30
|
+
pwsh -c "`$LV_BRANCH='release-1.4/neovim-0.9'; iwr https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.ps1 -UseBasicParsing | iex"
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
elif platform.system() == "Linux":
|
|
34
|
+
program = """
|
|
35
|
+
|
|
36
|
+
LV_BRANCH='release-1.4/neovim-0.9' bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh)
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
else:
|
|
40
|
+
raise NotImplementedError("unsupported platform")
|
|
41
|
+
# _res = Terminal(stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE).run_script(script=program, shell="default").print(desc="Running custom installer", capture=True)
|
|
42
|
+
# run script here as it requires user input
|
|
43
|
+
_ = program
|
|
44
|
+
return ""
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
pass
|
|
@@ -6,10 +6,20 @@ import platform
|
|
|
6
6
|
from typing import Optional
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
config_dict = {
|
|
10
|
+
"repo_url": "CUSTOM",
|
|
11
|
+
"doc": "ngrok secure introspectable tunnels to localhost",
|
|
12
|
+
"filename_template_windows_amd_64": "ngrok-stable-windows-amd64.zip",
|
|
13
|
+
"filename_template_linux_amd_64": "ngrok-stable-linux-amd64.zip",
|
|
14
|
+
"strip_v": False,
|
|
15
|
+
"exe_name": "ngrok"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
9
19
|
def main(version: Optional[str]):
|
|
10
20
|
_ = version
|
|
11
21
|
if platform.system() == "Windows":
|
|
12
|
-
program = "winget install ngrok.ngrok"
|
|
22
|
+
program = "winget install ngrok.ngrok --source winget"
|
|
13
23
|
elif platform.system() == "Linux":
|
|
14
24
|
# as per https://ngrok.com/docs/getting-started/?os=linux
|
|
15
25
|
program = """
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
"""nvim
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import platform
|
|
9
|
+
from typing import Optional
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
config_dict = {
|
|
13
|
+
"repo_url": "CUSTOM",
|
|
14
|
+
"doc": "Neovim",
|
|
15
|
+
"filename_template_windows_amd_64": "nvim-win64.zip",
|
|
16
|
+
"filename_template_linux_amd_64": "nvim-linux64.tar.gz",
|
|
17
|
+
"strip_v": False,
|
|
18
|
+
"exe_name": "nvim"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def main(version: Optional[str]):
|
|
23
|
+
_ = version
|
|
24
|
+
if platform.system() == "Windows":
|
|
25
|
+
program = """
|
|
26
|
+
winget install --no-upgrade --name "Neovim" --Id Neovim.Neovim --source winget --accept-package-agreements --accept-source-agreements
|
|
27
|
+
"""
|
|
28
|
+
elif platform.system() == "Linux":
|
|
29
|
+
program = """
|
|
30
|
+
# mkdir $HOME/tmp_install -p || true
|
|
31
|
+
# mkdir $HOME/.local/share -p || true
|
|
32
|
+
# cd $HOME/tmp_install || true
|
|
33
|
+
# wget https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz || true
|
|
34
|
+
# tar -xvf nvim-linux64.tar.gz -C $HOME/.local/share/ || true
|
|
35
|
+
# sudo cp ~/.local/share/nvim-linux64/bin/nvim /usr/local/bin/nvim || true
|
|
36
|
+
brew install neovim
|
|
37
|
+
# nix-env -iA nixpkgs.neovim
|
|
38
|
+
"""
|
|
39
|
+
_ = program
|
|
40
|
+
program = ""
|
|
41
|
+
else:
|
|
42
|
+
raise NotImplementedError("unsupported platform")
|
|
43
|
+
return program
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if __name__ == "__main__":
|
|
47
|
+
print("Executed!")
|
|
48
|
+
pass
|
|
@@ -5,6 +5,17 @@
|
|
|
5
5
|
from typing import Optional
|
|
6
6
|
import platform
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
config_dict = {
|
|
10
|
+
"repo_url": "CUSTOM",
|
|
11
|
+
"doc": "Visual Studio Code",
|
|
12
|
+
"filename_template_windows_amd_64": "VSCodeSetup-{}.exe",
|
|
13
|
+
"filename_template_linux_amd_64": "code_{}.deb",
|
|
14
|
+
"strip_v": True,
|
|
15
|
+
"exe_name": "code"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
8
19
|
def main(version: Optional[str] = None):
|
|
9
20
|
|
|
10
21
|
if platform.system() == 'Linux':
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
"""wezterm installer
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from machineconfig.utils.installer import Installer
|
|
6
|
+
from typing import Optional
|
|
7
|
+
import platform
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
config_dict = {
|
|
11
|
+
"repo_url": "https://github.com/wez/wezterm",
|
|
12
|
+
"doc": "cross-platform terminal emulator",
|
|
13
|
+
"filename_template_windows_amd_64": "WezTerm-windows-{}.zip",
|
|
14
|
+
"filename_template_linux_amd_64": "wezterm-{}.Ubuntu22.04.deb",
|
|
15
|
+
"strip_v": False,
|
|
16
|
+
"exe_name": "wezterm"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def main(version: Optional[str]):
|
|
21
|
+
if platform.system() == "Windows":
|
|
22
|
+
program = "winget install --Id wez.wezterm --source winget --accept-package-agreements --accept-source-agreements"
|
|
23
|
+
elif platform.system() == "Linux":
|
|
24
|
+
inst = Installer.from_dict(d=config_dict, name="wezterm")
|
|
25
|
+
program = ""
|
|
26
|
+
# as per https://wezfurlong.org/wezterm/install/linux.html#installing-on-ubuntu-and-debian-based-systems
|
|
27
|
+
downloaded, version_to_be_installed = inst.download(version=version)
|
|
28
|
+
_= version_to_be_installed
|
|
29
|
+
|
|
30
|
+
program = f"""
|
|
31
|
+
sudo apt install -y {downloaded}
|
|
32
|
+
rm {downloaded}
|
|
33
|
+
"""
|
|
34
|
+
else:
|
|
35
|
+
raise NotImplementedError("unsupported platform")
|
|
36
|
+
return program
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if __name__ == "__main__":
|
|
40
|
+
# main(version=None)
|
|
41
|
+
pass
|
machineconfig/profile/create.py
CHANGED
|
@@ -84,12 +84,15 @@ def main_symlinks(choice: Optional[str] = None):
|
|
|
84
84
|
try:
|
|
85
85
|
subprocess.run(f"chmod 700 ~/.ssh/", check=True)
|
|
86
86
|
subprocess.run(f"chmod 700 ~/dotfiles/creds/.ssh/", check=True) # may require sudo
|
|
87
|
-
subprocess.run(f"chmod 600 ~/dotfiles/creds/.ssh
|
|
87
|
+
subprocess.run(f"chmod 600 ~/dotfiles/creds/.ssh/*", check=True)
|
|
88
88
|
except Exception as e:
|
|
89
89
|
ERROR_LIST.append(e)
|
|
90
90
|
print("Caught error", e)
|
|
91
91
|
|
|
92
92
|
if system == "Linux": Terminal().run(f'chmod +x {LIBRARY_ROOT.joinpath(f"scripts/{system.lower()}")} -R')
|
|
93
|
+
print("\n\n", "*" * 200)
|
|
94
|
+
if len(ERROR_LIST) > 0:
|
|
95
|
+
print("Errors caught: ", ERROR_LIST)
|
|
93
96
|
|
|
94
97
|
|
|
95
98
|
def main(choice: Optional[str] = None):
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
|
|
2
|
+
"""
|
|
3
|
+
Choose a theme for Wezterm
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from machineconfig.utils.utils import choose_one_option, P
|
|
7
|
+
from typing import Any
|
|
8
|
+
import time
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
schemes_list = [
|
|
12
|
+
'Pro',
|
|
13
|
+
'Spiderman',
|
|
14
|
+
'shades-of-purple',
|
|
15
|
+
'synthwave',
|
|
16
|
+
'Symfonic',
|
|
17
|
+
'PaulMillr',
|
|
18
|
+
'Neon',
|
|
19
|
+
'LiquidCarbonTransparentInverse',
|
|
20
|
+
'Laser',
|
|
21
|
+
'IR_Black',
|
|
22
|
+
'Hurtado',
|
|
23
|
+
'Homebrew',
|
|
24
|
+
'Hipster Green',
|
|
25
|
+
'Firefly Traditional',
|
|
26
|
+
'Elementary',
|
|
27
|
+
'deep',
|
|
28
|
+
'Dark Pastel',
|
|
29
|
+
'Bright Lights',
|
|
30
|
+
'Adventure',
|
|
31
|
+
'Nancy (terminal.sexy)',
|
|
32
|
+
'Bim (Gogh)',
|
|
33
|
+
'BlueDolphin',
|
|
34
|
+
'Borland',
|
|
35
|
+
'Grass (Gogh)',
|
|
36
|
+
'Greenscreen (light) (terminal.sexy)',
|
|
37
|
+
'Grayscale (dark) (terminal.sexy)',
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def main2():
|
|
42
|
+
option = choose_one_option(options=schemes_list, header="Choose a theme for Wezterm", fzf=True)
|
|
43
|
+
set_theme(option)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def set_theme(theme: str):
|
|
47
|
+
txt_lines = P("~/.config/wezterm/wezterm.lua").expanduser().read_text().splitlines()
|
|
48
|
+
res_lines = []
|
|
49
|
+
for line in txt_lines:
|
|
50
|
+
if 'config.color_scheme = ' in line:
|
|
51
|
+
res_lines.append(f"config.color_scheme = '{theme}'")
|
|
52
|
+
else: res_lines.append(line)
|
|
53
|
+
P("~/.config/wezterm/wezterm.lua").expanduser().write_text('\n'.join(res_lines))
|
|
54
|
+
time.sleep(0.1)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def main():
|
|
58
|
+
import curses # not availble on windows: https://docs.python.org/3/howto/curses.html
|
|
59
|
+
# from curses import wrapper
|
|
60
|
+
curses.wrapper(accessory)
|
|
61
|
+
|
|
62
|
+
def accessory(stdscr: Any):
|
|
63
|
+
import curses
|
|
64
|
+
options = schemes_list
|
|
65
|
+
current_option = 0
|
|
66
|
+
page_size = stdscr.getmaxyx()[0] - 1 # curses.LINES - 1 # Number of lines in the terminal, -1 for status line
|
|
67
|
+
|
|
68
|
+
while True:
|
|
69
|
+
stdscr.clear()
|
|
70
|
+
|
|
71
|
+
# Calculate start and end indices for options
|
|
72
|
+
start_index = (current_option // page_size) * page_size
|
|
73
|
+
end_index = start_index + page_size
|
|
74
|
+
|
|
75
|
+
# Display options
|
|
76
|
+
for i, option in enumerate(options[start_index:end_index]):
|
|
77
|
+
if start_index + i == current_option:
|
|
78
|
+
stdscr.addstr(i, 0, option, curses.A_REVERSE) # Highlighted
|
|
79
|
+
else:
|
|
80
|
+
stdscr.addstr(i, 0, option)
|
|
81
|
+
|
|
82
|
+
# Display status line
|
|
83
|
+
status_line = f"Option {current_option+1} of {len(options)}. Use arrow keys to navigate, Enter to select."
|
|
84
|
+
stdscr.addstr(page_size, 0, status_line)
|
|
85
|
+
|
|
86
|
+
# Get key press
|
|
87
|
+
key = stdscr.getch()
|
|
88
|
+
|
|
89
|
+
# Handle key press
|
|
90
|
+
if key == curses.KEY_UP and current_option > 0:
|
|
91
|
+
current_option -= 1
|
|
92
|
+
elif key == curses.KEY_DOWN and current_option < len(options) - 1:
|
|
93
|
+
current_option += 1
|
|
94
|
+
elif key == ord('\n'): # Enter key
|
|
95
|
+
break # Exit the loop
|
|
96
|
+
set_theme(options[current_option])
|
|
@@ -14,7 +14,7 @@ from typing import Optional
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
@RepeatUntilNoException()
|
|
17
|
-
def get_securely_shared_file(url: Optional[str] = None, folder: Optional[str] = None):
|
|
17
|
+
def get_securely_shared_file(url: Optional[str] = None, folder: Optional[str] = None) -> None:
|
|
18
18
|
folder_obj = P.cwd() if folder is None else P(folder)
|
|
19
19
|
|
|
20
20
|
if os.environ.get("DECRYPTION_PASSWORD") is not None:
|
|
@@ -57,6 +57,7 @@ def arg_parser() -> None:
|
|
|
57
57
|
parser.add_argument("--pwd", "-p", help="Password for encryption", type=str, default=ArgsDefaults.pwd)
|
|
58
58
|
parser.add_argument("--encrypt", "-e", help="Decrypt after receiving.", action="store_true", default=ArgsDefaults.encrypt)
|
|
59
59
|
parser.add_argument("--zip", "-z", help="unzip after receiving.", action="store_true", default=ArgsDefaults.zip_)
|
|
60
|
+
parser.add_argument("--os_specific", "-o", help="choose path specific for this OS.", action="store_true", default=ArgsDefaults.os_specific)
|
|
60
61
|
|
|
61
62
|
parser.add_argument("--config", "-c", help="path to cloud.json file.", default=None)
|
|
62
63
|
|
|
@@ -86,6 +87,9 @@ def arg_parser() -> None:
|
|
|
86
87
|
share=args_obj.share)
|
|
87
88
|
if args_obj.share:
|
|
88
89
|
print(res.as_url_str())
|
|
90
|
+
if P(source).is_dir(): share_url_path = P(source).joinpath(".share_url")
|
|
91
|
+
else: share_url_path = P(source).with_suffix(".share_url")
|
|
92
|
+
share_url_path.write_text(res.as_url_str())
|
|
89
93
|
else: raise ValueError(f"Cloud `{cloud}` not found in source or target.")
|
|
90
94
|
|
|
91
95
|
|
|
@@ -43,20 +43,26 @@ mprocs "echo 'see {DEFAULT_MOUNT}/{cloud} for the mounted cloud'; rclone about {
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
def mount(cloud: Optional[str], network: Optional[str], destination: Optional[str]) -> None:
|
|
46
|
-
|
|
47
46
|
config = get_rclone_config()
|
|
48
47
|
if cloud is None:
|
|
49
48
|
res = choose_one_option(msg="which cloud", options=config.sections(), header="CLOUD MOUNT", default=None)
|
|
50
49
|
if type(res) is str: cloud = res
|
|
51
50
|
else: raise ValueError("no cloud selected")
|
|
52
51
|
|
|
53
|
-
|
|
54
52
|
if network is None:
|
|
55
|
-
if destination is None:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
if destination is None:
|
|
54
|
+
mount_loc = P(DEFAULT_MOUNT).expanduser().joinpath(cloud)
|
|
55
|
+
else:
|
|
56
|
+
mount_loc = P(destination)
|
|
57
|
+
|
|
58
|
+
if platform.system() == "Windows":
|
|
59
|
+
mount_loc.parent.create()
|
|
60
|
+
elif platform.system() == "Linux":
|
|
61
|
+
try: mount_loc.create()
|
|
62
|
+
except (FileExistsError, OSError) as err:
|
|
63
|
+
# We need a umount command here.
|
|
64
|
+
print(err)
|
|
65
|
+
pass
|
|
60
66
|
else: raise ValueError("unsupported platform")
|
|
61
67
|
|
|
62
68
|
elif network and platform.system() == "Windows": mount_loc = "X: --network-mode"
|
|
@@ -65,7 +71,9 @@ def mount(cloud: Optional[str], network: Optional[str], destination: Optional[st
|
|
|
65
71
|
mount_cmd = f"rclone mount {cloud}: {mount_loc} --vfs-cache-mode full --file-perms=0777"
|
|
66
72
|
|
|
67
73
|
# txt = get_mprocs_mount_txt(cloud, mount_cmd)
|
|
68
|
-
if platform.system() == "Windows":
|
|
74
|
+
if platform.system() == "Windows":
|
|
75
|
+
|
|
76
|
+
txt = f"""
|
|
69
77
|
wt --window 0 --profile "Windows PowerShell" --startingDirectory "$HOME/data/rclone" `; split-pane --horizontal --profile "Command Prompt" --size 0.2 powershell -Command "{mount_cmd}" `; split-pane --vertical --profile "Windows PowerShell" --size 0.2 powershell -NoExit -Command "rclone about {cloud}:" `; move-focus up
|
|
70
78
|
"""
|
|
71
79
|
elif platform.system() == "Linux": txt = f"""
|
|
@@ -74,8 +82,10 @@ ZJ_SESSIONS=$(zellij list-sessions)
|
|
|
74
82
|
|
|
75
83
|
if [[ "${{ZJ_SESSIONS}}" != *"(current)"* ]]; then
|
|
76
84
|
echo "Not inside a zellij session ..."
|
|
77
|
-
echo '{mount_cmd}'
|
|
78
|
-
exit 1
|
|
85
|
+
echo '{mount_cmd} --daemon'
|
|
86
|
+
# exit 1
|
|
87
|
+
|
|
88
|
+
{mount_cmd} --daemon
|
|
79
89
|
fi
|
|
80
90
|
|
|
81
91
|
zellij run --direction down --name rclone -- {mount_cmd}
|