mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-06 00:57:14 -04:00
Updated port-jobs to allow for packaging the new config setup, fixed offline mode error
Former-commit-id: 511d1d887fb34b8613f063fc7992418bb614a740 Former-commit-id: 03f6817527864c52012de1d02bb2c34e8fed8a18
This commit is contained in:
+11
-12
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
from sys import argv, exit as s_exit
|
||||
from sys import argv
|
||||
|
||||
# read arguments
|
||||
arguments = argv[1:]
|
||||
@@ -13,24 +13,23 @@ string2 = '# PORT END CLIPTOOL'
|
||||
if len(arguments) > 0:
|
||||
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
|
||||
replacement = """# check for clipboard tool and display warning if missing
|
||||
if 'WAYLAND_DISPLAY' in environ:
|
||||
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
|
||||
else:
|
||||
_display_server, _clipboard_tool, _clipboard_package = 'X11', 'xclip', 'xclip'
|
||||
from shutil import which
|
||||
if which(_clipboard_tool) is None:
|
||||
print(f'''\u001b[38;5;9mwarning: you are using {_display_server} and "{_clipboard_tool}" is not present -
|
||||
if 'WAYLAND_DISPLAY' in environ:
|
||||
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
|
||||
else:
|
||||
_display_server, _clipboard_tool, _clipboard_package = 'X11', 'xclip', 'xclip'
|
||||
if which(_clipboard_tool) is None:
|
||||
print(f'''\n\u001b[38;5;9mwarning: you are using {_display_server} and "{_clipboard_tool}" is not present -
|
||||
copying entry fields will not function until "{_clipboard_package}" is installed\u001b[0m
|
||||
''')"""
|
||||
''')"""
|
||||
else:
|
||||
regex = re.compile(f"{string1}.*?{string2}\n\n", re.DOTALL)
|
||||
regex = re.compile(f"{string1}.*?{string2}\n", re.DOTALL)
|
||||
replacement = ''
|
||||
|
||||
# read input file
|
||||
text = open('working/sshyp.py', 'r').read()
|
||||
text = open('working/stweak.py', 'r').read()
|
||||
|
||||
# find and replace the defined PORT target
|
||||
new_text = re.sub(regex, replacement, text)
|
||||
|
||||
# write updated text
|
||||
open('working/sshyp.py', 'w').write(new_text)
|
||||
open('working/stweak.py', 'w').write(new_text)
|
||||
|
||||
Reference in New Issue
Block a user