machineconfig 1.8__py3-none-any.whl → 1.91__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 +8 -6
- machineconfig/jobs/python/checkout_version.py +27 -32
- machineconfig/jobs/python/create_bootable_media.py +1 -1
- machineconfig/jobs/python/python_cargo_build_share.py +2 -2
- machineconfig/jobs/python/tasks.py +2 -2
- machineconfig/jobs/python_custom_installers/gh.py +53 -0
- machineconfig/jobs/python_custom_installers/hx.py +55 -0
- machineconfig/profile/create.py +26 -21
- machineconfig/profile/create_hardlinks.py +101 -0
- machineconfig/profile/shell.py +5 -5
- machineconfig/scripts/python/choose_wezterm_theme.py +96 -0
- machineconfig/scripts/python/cloud_copy.py +24 -17
- machineconfig/scripts/python/cloud_mount.py +20 -10
- machineconfig/scripts/python/cloud_repo_sync.py +109 -56
- machineconfig/scripts/python/cloud_sync.py +73 -68
- machineconfig/scripts/python/croshell.py +23 -14
- machineconfig/scripts/python/devops.py +19 -20
- machineconfig/scripts/python/devops_backup_retrieve.py +19 -10
- machineconfig/scripts/python/devops_devapps_install.py +81 -57
- machineconfig/scripts/python/devops_update_repos.py +5 -5
- machineconfig/scripts/python/dotfile.py +4 -4
- machineconfig/scripts/python/fire_jobs.py +139 -66
- machineconfig/scripts/python/ftpx.py +17 -7
- machineconfig/scripts/python/gh_models.py +53 -0
- machineconfig/scripts/python/mount_nfs.py +1 -1
- machineconfig/scripts/python/mount_nw_drive.py +3 -3
- machineconfig/scripts/python/mount_ssh.py +2 -3
- machineconfig/scripts/python/pomodoro.py +1 -1
- machineconfig/scripts/python/repos.py +26 -23
- machineconfig/scripts/python/scheduler.py +1 -1
- machineconfig/scripts/python/start_slidev.py +10 -4
- machineconfig/scripts/python/start_terminals.py +6 -5
- machineconfig/scripts/python/wifi_conn.py +34 -42
- machineconfig/scripts/python/wsl_windows_transfer.py +1 -1
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +1 -1
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +3 -2
- machineconfig/utils/installer.py +167 -60
- machineconfig/utils/procs.py +2 -2
- machineconfig/utils/scheduling.py +3 -3
- machineconfig/utils/utils.py +137 -56
- machineconfig/utils/ve.py +171 -100
- machineconfig-1.91.dist-info/LICENSE +201 -0
- {machineconfig-1.8.dist-info → machineconfig-1.91.dist-info}/METADATA +31 -11
- machineconfig-1.91.dist-info/RECORD +69 -0
- {machineconfig-1.8.dist-info → machineconfig-1.91.dist-info}/WHEEL +1 -1
- machineconfig/jobs/script_installer/azure_data_studio.py +0 -22
- machineconfig/jobs/script_installer/bypass_paywall.py +0 -23
- machineconfig/jobs/script_installer/code.py +0 -34
- machineconfig/jobs/script_installer/docker_desktop.py +0 -41
- machineconfig/jobs/script_installer/ngrok.py +0 -29
- machineconfig/jobs/script_installer/skim.py +0 -21
- machineconfig/jobs/script_installer/wezterm.py +0 -34
- machineconfig-1.8.dist-info/RECORD +0 -70
- /machineconfig/jobs/{script_installer → python_custom_installers}/__init__.py +0 -0
- {machineconfig-1.8.dist-info → machineconfig-1.91.dist-info}/top_level.txt +0 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
"""Repos
|
|
3
|
+
|
|
4
|
+
# TODO use gh api user --jq '.login' to get the username and use it to clone the repos.
|
|
5
|
+
in the event that username@github.com is not mentioned in the remote url.
|
|
6
|
+
|
|
3
7
|
"""
|
|
4
8
|
|
|
5
9
|
from rich import print as pprint
|
|
6
10
|
from machineconfig.utils.utils import write_shell_script, CONFIG_PATH, DEFAULTS_PATH
|
|
7
|
-
from crocodile.file_management import P,
|
|
11
|
+
from crocodile.file_management import P, Read, Save
|
|
8
12
|
from crocodile.core import randstr
|
|
9
13
|
import argparse
|
|
10
14
|
from dataclasses import dataclass
|
|
@@ -27,7 +31,7 @@ class RepoRecord:
|
|
|
27
31
|
version: dict[str, str]
|
|
28
32
|
|
|
29
33
|
|
|
30
|
-
def git_action(path: P, action: GitAction, mess: Optional[str] = None, r: bool
|
|
34
|
+
def git_action(path: P, action: GitAction, mess: Optional[str] = None, r: bool=False) -> str:
|
|
31
35
|
from git.exc import InvalidGitRepositoryError
|
|
32
36
|
from git.repo import Repo
|
|
33
37
|
try:
|
|
@@ -53,7 +57,7 @@ git add .; git commit -am "{mess}"
|
|
|
53
57
|
action_name = "pull" if action == GitAction.pull else "push"
|
|
54
58
|
cmds = [f'echo "pulling from {remote.url}" ; git {action_name} {remote.name} {repo.active_branch.name}' for remote in repo.remotes]
|
|
55
59
|
program += '\n' + '\n'.join(cmds) + '\n'
|
|
56
|
-
program = program +
|
|
60
|
+
program = program + '''
|
|
57
61
|
echo ""; echo ""
|
|
58
62
|
'''
|
|
59
63
|
return program
|
|
@@ -64,41 +68,40 @@ def main():
|
|
|
64
68
|
# POSITIONAL
|
|
65
69
|
parser.add_argument("directory", help="folder containing repos to record a json out of OR a specs json file to follow.", default="")
|
|
66
70
|
# FLAGS
|
|
67
|
-
parser.add_argument("--push", help=
|
|
68
|
-
parser.add_argument("--pull", help=
|
|
69
|
-
parser.add_argument("--commit", help=
|
|
70
|
-
parser.add_argument("--all", help=
|
|
71
|
-
parser.add_argument("--record", help=
|
|
72
|
-
parser.add_argument("--clone", help=
|
|
73
|
-
parser.add_argument("--checkout", help=
|
|
71
|
+
parser.add_argument("--push", help="push", action="store_true")
|
|
72
|
+
parser.add_argument("--pull", help="pull", action="store_true")
|
|
73
|
+
parser.add_argument("--commit", help="commit", action="store_true")
|
|
74
|
+
parser.add_argument("--all", help="pull, commit and push", action="store_true")
|
|
75
|
+
parser.add_argument("--record", help="record respos", action="store_true")
|
|
76
|
+
parser.add_argument("--clone", help="clone repos from record", action="store_true")
|
|
77
|
+
parser.add_argument("--checkout", help="Check out to versions prvided in this json file", action="store_true")
|
|
74
78
|
parser.add_argument("--checkout_to_branch", help="Checkout to the main branch", action="store_true")
|
|
75
|
-
parser.add_argument("--recursive", "-r", help=
|
|
79
|
+
parser.add_argument("--recursive", "-r", help="recursive flag", action="store_true")
|
|
76
80
|
# OPTIONAL
|
|
77
|
-
parser.add_argument("--cloud", "-c", help=
|
|
81
|
+
parser.add_argument("--cloud", "-c", help="cloud", default=None)
|
|
78
82
|
args = parser.parse_args()
|
|
79
83
|
|
|
80
84
|
if args.directory == "": repos_root = P.home().joinpath("code") # it is a positional argument, can never be empty.
|
|
81
85
|
else: repos_root = P(args.directory).expanduser().absolute()
|
|
82
|
-
_ = install_n_import("git", "gitpython")
|
|
83
86
|
|
|
84
87
|
program = ""
|
|
85
88
|
if args.record:
|
|
86
89
|
res = record_repos(repos_root=str(repos_root))
|
|
87
|
-
pprint(
|
|
90
|
+
pprint("Recorded repositories:\n", res)
|
|
88
91
|
save_path = CONFIG_PATH.joinpath("repos").joinpath(repos_root.rel2home()).joinpath("repos.json")
|
|
89
92
|
# Save.pickle(obj=res, path=save_path)
|
|
90
|
-
Save.json(obj=res, path=save_path)
|
|
93
|
+
Save.json(obj=res, path=save_path, indent=4)
|
|
91
94
|
pprint(f"Result pickled at {P(save_path)}")
|
|
92
95
|
if args.cloud is not None: P(save_path).to_cloud(rel2home=True, cloud=args.cloud)
|
|
93
|
-
program +=
|
|
96
|
+
program += """\necho '>>>>>>>>> Finished Recording'\n"""
|
|
94
97
|
elif args.clone or args.checkout or args.checkout_to_branch:
|
|
95
98
|
# preferred_remote = input("Enter preferred remote to use (default: None): ") or ""
|
|
96
|
-
program +=
|
|
99
|
+
program += """\necho '>>>>>>>>> Cloning Repos'\n"""
|
|
97
100
|
if not repos_root.exists() or repos_root.stem != 'repos.json': # user didn't pass absolute path to pickle file, but rather expected it to be in the default save location
|
|
98
101
|
repos_root = CONFIG_PATH.joinpath("repos").joinpath(repos_root.rel2home()).joinpath("repos.json")
|
|
99
102
|
if not repos_root.exists():
|
|
100
103
|
if args.cloud is None:
|
|
101
|
-
cloud: str
|
|
104
|
+
cloud: str=Read.ini(DEFAULTS_PATH)['general']['rclone_config_name']
|
|
102
105
|
print(f"⚠️ Using default cloud: {cloud}")
|
|
103
106
|
else:
|
|
104
107
|
cloud = args.cloud
|
|
@@ -118,7 +121,7 @@ def main():
|
|
|
118
121
|
write_shell_script(program, "Script to update repos")
|
|
119
122
|
|
|
120
123
|
|
|
121
|
-
def record_repos(repos_root: str, r: bool
|
|
124
|
+
def record_repos(repos_root: str, r: bool=True) -> list[dict[str, Any]]:
|
|
122
125
|
path_obj = P(repos_root).expanduser().absolute()
|
|
123
126
|
if path_obj.is_file(): return []
|
|
124
127
|
search_res = path_obj.search("*", files=False)
|
|
@@ -131,7 +134,7 @@ def record_repos(repos_root: str, r: bool = True) -> list[dict[str, Any]]:
|
|
|
131
134
|
return res
|
|
132
135
|
|
|
133
136
|
|
|
134
|
-
def record_a_repo(path: P, search_parent_directories: bool
|
|
137
|
+
def record_a_repo(path: P, search_parent_directories: bool=False, preferred_remote: Optional[str] = None):
|
|
135
138
|
from git.repo import Repo
|
|
136
139
|
repo = Repo(path, search_parent_directories=search_parent_directories) # get list of remotes using git python
|
|
137
140
|
repo_root = P(repo.working_dir).absolute()
|
|
@@ -156,7 +159,7 @@ def record_a_repo(path: P, search_parent_directories: bool = False, preferred_re
|
|
|
156
159
|
return res
|
|
157
160
|
|
|
158
161
|
|
|
159
|
-
def install_repos(specs_path: str, clone: bool
|
|
162
|
+
def install_repos(specs_path: str, clone: bool=True, checkout_to_recorded_commit: bool=False, checkout_to_branch: bool=False, editable_install: bool=False, preferred_remote: Optional[str] = None):
|
|
160
163
|
program = ""
|
|
161
164
|
path_obj = P(specs_path).expanduser().absolute()
|
|
162
165
|
repos: list[dict[str, Any]] = Read.json(path_obj)
|
|
@@ -168,7 +171,7 @@ def install_repos(specs_path: str, clone: bool = True, checkout_to_recorded_comm
|
|
|
168
171
|
if preferred_remote is not None:
|
|
169
172
|
if preferred_remote in repo["remotes"]:
|
|
170
173
|
remote_name = preferred_remote
|
|
171
|
-
remote_url
|
|
174
|
+
remote_url = repo["remotes"][preferred_remote]
|
|
172
175
|
else:
|
|
173
176
|
print(f"⚠️ `{preferred_remote=}` not found in {repo['remotes']}.")
|
|
174
177
|
# preferred_remote = None
|
|
@@ -185,7 +188,7 @@ def install_repos(specs_path: str, clone: bool = True, checkout_to_recorded_comm
|
|
|
185
188
|
program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git checkout {repo['current_branch']}"
|
|
186
189
|
break
|
|
187
190
|
if editable_install and idx == 0:
|
|
188
|
-
program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; pip install -e ."
|
|
191
|
+
program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; uv pip install -e ."
|
|
189
192
|
program += "\n"
|
|
190
193
|
pprint(program)
|
|
191
194
|
return program
|
|
@@ -45,7 +45,7 @@ def main_parse():
|
|
|
45
45
|
print(f"✅ Task {task_name} created in {task_root}. Head there and edit the config.ini file & task.py file.")
|
|
46
46
|
return None
|
|
47
47
|
|
|
48
|
-
main(root=root.
|
|
48
|
+
main(root=root.to_str(), ignore_conditions=args.ignore_conditions)
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
if __name__ == "__main__":
|
|
@@ -16,7 +16,7 @@ PORT_DEFAULT = 3030
|
|
|
16
16
|
SLIDEV_REPO = CONFIG_PATH.joinpath(".cache/slidev")
|
|
17
17
|
if not SLIDEV_REPO.joinpath("components").exists():
|
|
18
18
|
# assert slidev is installed first
|
|
19
|
-
Terminal(stderr=subprocess.PIPE, stdin=subprocess.PIPE, stdout=subprocess.PIPE).run(f"cd {SLIDEV_REPO.parent};npm init slidev")
|
|
19
|
+
Terminal(stderr=subprocess.PIPE, stdin=subprocess.PIPE, stdout=subprocess.PIPE).run(f"cd {SLIDEV_REPO.parent};npm init slidev@latest")
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def jupyter_to_markdown(file: P):
|
|
@@ -55,10 +55,11 @@ def main() -> None:
|
|
|
55
55
|
parser = argparse.ArgumentParser()
|
|
56
56
|
parser.add_argument("-d", "--directory", default=None, help="Directory of the report")
|
|
57
57
|
parser.add_argument("-j", "--jupyter-file", default=None, help="Jupyter notebook file to convert to slides. If not provided, slides.md is used.")
|
|
58
|
-
parser.add_argument("--port", default=PORT_DEFAULT, help=f"Port to serve the report, default to {PORT_DEFAULT}")
|
|
58
|
+
# parser.add_argument("--port", default=PORT_DEFAULT, help=f"Port to serve the report, default to {PORT_DEFAULT}")
|
|
59
59
|
args = parser.parse_args()
|
|
60
60
|
|
|
61
|
-
port = args.port
|
|
61
|
+
# port = args.port
|
|
62
|
+
port = PORT_DEFAULT
|
|
62
63
|
|
|
63
64
|
if args.jupyter_file is not None:
|
|
64
65
|
report_dir = jupyter_to_markdown(P(args.jupyter_file))
|
|
@@ -95,7 +96,12 @@ def main() -> None:
|
|
|
95
96
|
print(f"Presentation is served at http://{platform.node()}:{port}")
|
|
96
97
|
print(f"Presentation is served at http://localhost:{port}")
|
|
97
98
|
print(f"Presentation is served at http://{local_ip_v4}:{port}")
|
|
98
|
-
|
|
99
|
+
# This version requires a globally installed cli of slidev, which is not recommended.
|
|
100
|
+
# program: str=f"cd {SLIDEV_REPO}; slidev --port {port} --remote 0.0.0.0; cd {P.cwd()}"
|
|
101
|
+
|
|
102
|
+
# The recommended approach is do `npm init slidev@latest` in the directory where you want to create the presentation
|
|
103
|
+
# Then you can do the following:
|
|
104
|
+
program = "npm run dev slides.md -- --remote"
|
|
99
105
|
PROGRAM_PATH.write_text(program)
|
|
100
106
|
print_code(program, lexer="bash")
|
|
101
107
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"""Script to start terminals on windows and wsl
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from machineconfig.utils.utils import PROGRAM_PATH, display_options,
|
|
5
|
+
from machineconfig.utils.utils import PROGRAM_PATH, display_options, get_ssh_hosts, platform
|
|
6
6
|
from itertools import cycle
|
|
7
7
|
from typing import Literal
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
COLOR_SCHEMES = ["Campbell", "Campbell Powershell", "Solarized Dark", "Ubuntu-ColorScheme", "Retro"]
|
|
11
11
|
THEMES_ITER = cycle(COLOR_SCHEMES)
|
|
12
|
-
INIT_COMMANDS = ["ls", "lf", "cpufetch", "
|
|
12
|
+
INIT_COMMANDS = ["ls", "lf", "cpufetch", "fastfetch", "btm"]
|
|
13
13
|
INIT_COMMANDS_ITER = cycle(INIT_COMMANDS)
|
|
14
14
|
SIZE_ITER = cycle([0.6, 0.4, 0.3])
|
|
15
15
|
ORIENTATION = ["vertical", "horizontal"]
|
|
@@ -22,14 +22,14 @@ THIS_MACHINE_HOSTNAME = platform.node()
|
|
|
22
22
|
THIS_MACHINE_HOSTNAME_WSL = f"{THIS_MACHINE_HOSTNAME}wsl"
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def main_windows_and_wsl(window: int, hosts: list[str], orientation: ORIENTATION_TYPE = "vertical", mprocs: bool
|
|
25
|
+
def main_windows_and_wsl(window: int, hosts: list[str], orientation: ORIENTATION_TYPE = "vertical", mprocs: bool=False):
|
|
26
26
|
orientation_oposite = "horizontal" if orientation == "vertical" else "vertical"
|
|
27
27
|
orientation_swap = "up" if orientation == "horizontal" else "left"
|
|
28
28
|
orientation_opposite_move_focus = "up" if orientation_oposite == "horizontal" else "left"
|
|
29
29
|
orientation_opposite_move_focus_other = "down" if orientation_oposite == "horizontal" else "right"
|
|
30
30
|
sleep = 3
|
|
31
31
|
sep = f"\nsleep {sleep}; wt --window {window}" # or '`;'
|
|
32
|
-
ssh_cmd =
|
|
32
|
+
ssh_cmd = "-t 'mprocs'" if mprocs else '' # 'wsl_ssh_windows_port_forwarding.ps1'
|
|
33
33
|
split_per_machine = 1 / len(hosts)
|
|
34
34
|
size = 0.3
|
|
35
35
|
known_hosts = get_ssh_hosts()
|
|
@@ -89,7 +89,8 @@ def main():
|
|
|
89
89
|
cmd = main_windows_and_wsl(window=args.window, hosts=hosts, orientation="vertical" if args.vertical else "horizontal")
|
|
90
90
|
|
|
91
91
|
print(cmd)
|
|
92
|
-
|
|
92
|
+
# import clipboard
|
|
93
|
+
# install_n_import("clipboard").copy(cmd)
|
|
93
94
|
PROGRAM_PATH.write_text(cmd)
|
|
94
95
|
|
|
95
96
|
|
|
@@ -1,50 +1,44 @@
|
|
|
1
|
-
|
|
2
1
|
"""Wifi connect
|
|
2
|
+
|
|
3
|
+
sudo apt-get install network-manager
|
|
4
|
+
|
|
3
5
|
"""
|
|
4
6
|
|
|
5
7
|
import argparse
|
|
6
8
|
import configparser
|
|
7
9
|
from pathlib import Path
|
|
8
|
-
# import random
|
|
9
|
-
# import string
|
|
10
10
|
import os
|
|
11
|
-
|
|
11
|
+
import platform
|
|
12
|
+
import subprocess
|
|
12
13
|
|
|
13
14
|
def create_new_connection(name: str, ssid: str, password: str):
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<authEncryption>
|
|
27
|
-
<authentication>WPA2PSK</authentication>
|
|
28
|
-
<encryption>AES</encryption>
|
|
29
|
-
<useOneX>false</useOneX>
|
|
30
|
-
</authEncryption>
|
|
31
|
-
<sharedKey>
|
|
32
|
-
<keyType>passPhrase</keyType>
|
|
33
|
-
<protected>false</protected>
|
|
34
|
-
<keyMaterial>""" + password + """</keyMaterial>
|
|
35
|
-
</sharedKey>
|
|
36
|
-
</security>
|
|
37
|
-
</MSM>
|
|
38
|
-
</WLANProfile>"""
|
|
39
|
-
command = "netsh wlan add profile filename=\"" + name + ".xml\"" + " interface=Wi-Fi"
|
|
40
|
-
with open(name + ".xml", mode='w', encoding="utf-8") as file: file.write(config)
|
|
41
|
-
os.system(command)
|
|
42
|
-
|
|
15
|
+
if platform.system() == "Windows":
|
|
16
|
+
config = """<?xml version=\"1.0\"?>
|
|
17
|
+
// ...existing XML config...
|
|
18
|
+
"""
|
|
19
|
+
command = "netsh wlan add profile filename=\"" + name + ".xml\"" + " interface=Wi-Fi"
|
|
20
|
+
with open(name + ".xml", mode='w', encoding="utf-8") as file:
|
|
21
|
+
file.write(config)
|
|
22
|
+
os.system(command)
|
|
23
|
+
elif platform.system() == "Linux":
|
|
24
|
+
# Use nmcli to add/update connection
|
|
25
|
+
command = f"nmcli connection add type wifi con-name '{name}' ssid '{ssid}' wifi-sec.key-mgmt wpa-psk wifi-sec.psk '{password}'"
|
|
26
|
+
subprocess.run(command, shell=True, check=True)
|
|
43
27
|
|
|
44
28
|
def connect(name: str, ssid: str):
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
29
|
+
if platform.system() == "Windows":
|
|
30
|
+
command = "netsh wlan connect name=\"" + name + "\" ssid=\"" + ssid + "\" interface=Wi-Fi"
|
|
31
|
+
os.system(command)
|
|
32
|
+
elif platform.system() == "Linux":
|
|
33
|
+
command = f"nmcli connection up '{name}'"
|
|
34
|
+
subprocess.run(command, shell=True, check=True)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def display_available_networks():
|
|
38
|
+
if platform.system() == "Windows":
|
|
39
|
+
os.system("netsh wlan show networks interface=Wi-Fi")
|
|
40
|
+
elif platform.system() == "Linux":
|
|
41
|
+
subprocess.run("nmcli device wifi list", shell=True, check=True)
|
|
48
42
|
|
|
49
43
|
|
|
50
44
|
def main():
|
|
@@ -52,20 +46,18 @@ def main():
|
|
|
52
46
|
creds.read(Path.home().joinpath('dotfiles/machineconfig/setup/wifi.ini'))
|
|
53
47
|
|
|
54
48
|
parser = argparse.ArgumentParser(description='Wifi Connector')
|
|
55
|
-
parser.add_argument('-n', "--ssid", help=
|
|
49
|
+
parser.add_argument('-n', "--ssid", help="SSID of Wifi", default='MyPhoneHotSpot')
|
|
56
50
|
|
|
57
51
|
args = parser.parse_args()
|
|
58
52
|
ssid = creds[args.ssid]['SSID']
|
|
59
|
-
|
|
53
|
+
password = creds[args.ssid]['pwd'] # You'll need the password for Linux connections
|
|
60
54
|
|
|
61
|
-
#
|
|
62
|
-
|
|
55
|
+
# Create and connect to the network
|
|
56
|
+
create_new_connection(ssid, ssid, password)
|
|
63
57
|
connect(ssid, ssid)
|
|
64
58
|
|
|
65
59
|
|
|
66
60
|
def get_current_wifi_name() -> str:
|
|
67
|
-
import subprocess
|
|
68
|
-
import platform
|
|
69
61
|
if platform.system() == "Windows":
|
|
70
62
|
try:
|
|
71
63
|
cmd_output = subprocess.check_output(["netsh", "wlan", "show", "interface"], shell=True).decode("utf-8")
|
|
@@ -28,7 +28,7 @@ Otherwise, a flag must be raised to indicate the direction.""")
|
|
|
28
28
|
path = P(args.path).expanduser().absolute()
|
|
29
29
|
|
|
30
30
|
if args.same_file_system:
|
|
31
|
-
print(
|
|
31
|
+
print("💥 Using a not recommended transfer method! Copying same files across different file systems.")
|
|
32
32
|
if system == "Windows": # move files over to WSL
|
|
33
33
|
path.copy(folder=WSL_FROM_WIN.joinpath(UserName).joinpath(path.rel2home().parent), overwrite=True) # the following works for files and folders alike.
|
|
34
34
|
else: # move files from WSL to win
|
|
@@ -32,7 +32,7 @@ def install_nerd_fonts():
|
|
|
32
32
|
folder.search("*readme*").apply(lambda p: p.delete(sure=True))
|
|
33
33
|
folder.search("*LICENSE*").apply(lambda p: p.delete(sure=True))
|
|
34
34
|
file = P.tmpfile(suffix=".ps1").write_text(LIBRARY_ROOT.joinpath("setup_windows/wt_and_pwsh/install_fonts.ps1").read_text().replace(r".\fonts-to-be-installed", str(folder)))
|
|
35
|
-
subprocess.run(rf"powershell.exe -executionpolicy Bypass -nologo -noninteractive -File {file.
|
|
35
|
+
subprocess.run(rf"powershell.exe -executionpolicy Bypass -nologo -noninteractive -File {file.to_str()}", check=True)
|
|
36
36
|
folder.delete(sure=True)
|
|
37
37
|
|
|
38
38
|
|
|
@@ -52,7 +52,7 @@ class TerminalSettings(object):
|
|
|
52
52
|
|
|
53
53
|
# 1- Customizing Powershell========================================================
|
|
54
54
|
# as opposed to Windows Powershell
|
|
55
|
-
def customize_powershell(self, nerd_font: bool
|
|
55
|
+
def customize_powershell(self, nerd_font: bool=True):
|
|
56
56
|
pwsh: dict[str, Any] = dict(name="PowerShell",
|
|
57
57
|
commandline="pwsh",
|
|
58
58
|
hidden=False,
|
|
@@ -65,7 +65,8 @@ class TerminalSettings(object):
|
|
|
65
65
|
if item["name"] == "PowerShell":
|
|
66
66
|
self.profs.list[idx].update(pwsh)
|
|
67
67
|
break
|
|
68
|
-
else:
|
|
68
|
+
else:
|
|
69
|
+
print("Couldn't customize powershell because profile not found, try to install it first.")
|
|
69
70
|
|
|
70
71
|
def make_powershell_default_profile(self):
|
|
71
72
|
for profile in self.profs:
|