Remove trailing spaces upon commit

This commit is contained in:
2024-01-07 16:44:39 -05:00
parent 5ce28e1138
commit 5d00f83df0
4 changed files with 18 additions and 17 deletions
+1
View File
@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
sed -i 's/[[:space:]]*$//' ./lib/* ./port-jobs/* ./package.sh
git add -f extra lib/sshyp.py lib/sshync.py lib/stweak.py lib/clipclear.py port-jobs share LICENSE README.md package.sh commit.sh .gitignore git add -f extra lib/sshyp.py lib/sshync.py lib/stweak.py lib/clipclear.py port-jobs share LICENSE README.md package.sh commit.sh .gitignore
git commit -m "$1" git commit -m "$1"
git push git push
+9 -9
View File
@@ -232,7 +232,7 @@ def target_exists_check(_target_name, _expected_presence):
else: else:
print(f"\n\u001b[38;5;9merror: (/{_target_name}) does not exist\u001b[0m\n") print(f"\n\u001b[38;5;9merror: (/{_target_name}) does not exist\u001b[0m\n")
s_exit(2) s_exit(2)
# returns target type (entry == True, folder == False, null == None), optional errors # returns target type (entry == True, folder == False, null == None), optional errors
def target_type_check(_target_name, _expected_type=True, _error=False): def target_type_check(_target_name, _expected_type=True, _error=False):
@@ -299,7 +299,7 @@ def print_info():
f"version 1.5.2\u001b[38;5;15;48;5;15m{18*' '}\u001b[38;5;7;48;5;8m/\u001b[0m") f"version 1.5.2\u001b[38;5;15;48;5;15m{18*' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
print(f"\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{14*' '}\u001b[38;5;15;48;5;8mthe fortified flock" print(f"\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{14*' '}\u001b[38;5;15;48;5;8mthe fortified flock"
f" update\u001b[38;5;15;48;5;15m{15*' '}\u001b[38;5;7;48;5;8m/\u001b[0m\n{_blank}") f" update\u001b[38;5;15;48;5;15m{15*' '}\u001b[38;5;7;48;5;8m/\u001b[0m\n{_blank}")
print(f"\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{9*' '}\u001b[38;5;15;48;5;8mcopyright 2021-2024 ", print(f"\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{9*' '}\u001b[38;5;15;48;5;8mcopyright 2021-2024 ",
f"randall winkhart\u001b[38;5;15;48;5;15m{9*' '}\u001b[38;5;7;48;5;8m/\u001b[0m") f"randall winkhart\u001b[38;5;15;48;5;15m{9*' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
print(f"{_blank}\n{_border}\nsee https://github.com/rwinkhart/sshyp for more information\n") print(f"{_blank}\n{_border}\nsee https://github.com/rwinkhart/sshyp for more information\n")
elif arguments[0] == 'license': elif arguments[0] == 'license':
@@ -461,7 +461,7 @@ def rename():
Path(f"{directory}{_new_name}").mkdir(mode=0o700, parents=True, exist_ok=True) Path(f"{directory}{_new_name}").mkdir(mode=0o700, parents=True, exist_ok=True)
run(('ssh', '-i', identity, '-p', port, f"{username_ssh}@{ip}", run(('ssh', '-i', identity, '-p', port, f"{username_ssh}@{ip}",
f'python3 -c \'from pathlib import Path; Path("{directory_ssh}{entry_name}")' f'python3 -c \'from pathlib import Path; Path("{directory_ssh}{entry_name}")'
f'.rename(Path("{directory_ssh}{_new_name}"))\'')) f'.rename(Path("{directory_ssh}{_new_name}"))\''))
else: else:
move(f"{directory}{entry_name}", f"{directory}{_new_name}") move(f"{directory}{entry_name}", f"{directory}{_new_name}")
if not ssh_error: if not ssh_error:
@@ -473,7 +473,7 @@ def rename():
def edit(): def edit():
# set to avoid PEP8 warnings # set to avoid PEP8 warnings
_detail, _edit_line = None, None _detail, _edit_line = None, None
# ensure the edit target is an entry # ensure the edit target is an entry
target_type_check(entry_name, True, True) target_type_check(entry_name, True, True)
@@ -501,7 +501,7 @@ def gen():
_username, _url, _notes = None, None, None _username, _url, _notes = None, None, None
# gen update # gen update
if arg_count == 3 and arguments[2] in ('update', '-u'): if arg_count == 3 and arguments[2] in ('update', '-u'):
# ensure the gen update target is an entry # ensure the gen update target is an entry
target_type_check(entry_name, True, True) target_type_check(entry_name, True, True)
_new_lines = line_edit(decrypt(directory + entry_name, _quick_verify=quick_unlock_enabled), pass_gen(), 0) _new_lines = line_edit(decrypt(directory + entry_name, _quick_verify=quick_unlock_enabled), pass_gen(), 0)
# gen # gen
@@ -613,10 +613,10 @@ if __name__ == "__main__":
try: try:
# set default states # set default states
ssh_error, success_flag, sync_flag, silent_sync, pass_show = False, False, False, False, False ssh_error, success_flag, sync_flag, silent_sync, pass_show = False, False, False, False, False
# set to avoid PEP8 warnings # set to avoid PEP8 warnings
arg_start, device_type, offline_mode_enabled = None, None, None arg_start, device_type, offline_mode_enabled = None, None, None
# retrieve typed argument # retrieve typed argument
arguments = argv[1:] arguments = argv[1:]
arg_count = len(arguments) arg_count = len(arguments)
@@ -716,14 +716,14 @@ if __name__ == "__main__":
success_flag = True success_flag = True
from stweak import wrapped_entry from stweak import wrapped_entry
wrapped_entry(device_type) wrapped_entry(device_type)
if arg_count > 0 and success_flag == 0 and arguments[0] != 'sync': if arg_count > 0 and success_flag == 0 and arguments[0] != 'sync':
if arguments[0] not in ('help', '-h', 'version', '-v', 'license'): if arguments[0] not in ('help', '-h', 'version', '-v', 'license'):
extension_runner() extension_runner()
else: else:
print_info() print_info()
elif not ssh_error: elif not ssh_error:
if sync_flag: if sync_flag:
sync() sync()
elif (arg_count > 0 and arguments[0] == 'sync') or (arg_count > 1 and arguments[1] == 'shear'): elif (arg_count > 0 and arguments[0] == 'sync') or (arg_count > 1 and arguments[1] == 'shear'):
sync('\n') sync('\n')
+7 -7
View File
@@ -217,7 +217,7 @@ def ssh_config(_reconfig=False):
run(('ssh-keygen', '-q', '-t', 'ed25519', '-N', _passphrase, '-f', _ssh_key)) run(('ssh-keygen', '-q', '-t', 'ed25519', '-N', _passphrase, '-f', _ssh_key))
else: else:
_ssh_key = _keys[_key_selected_num] _ssh_key = _keys[_key_selected_num]
# ssh+sshync configuration # ssh+sshync configuration
_uiport = curses_text('enter the username, ip, and ssh port of your sshyp server:\n\n\n\n\n(ctrl+g/enter to ' _uiport = curses_text('enter the username, ip, and ssh port of your sshyp server:\n\n\n\n\n(ctrl+g/enter to '
'confirm)\n\nexample inputs:\n\n ipv4: user@10.10.10.10:22\n ipv6: user@[2000:2000:2000:2000' 'confirm)\n\nexample inputs:\n\n ipv4: user@10.10.10.10:22\n ipv6: user@[2000:2000:2000:2000'
@@ -300,7 +300,7 @@ def refresh_encryption():
f" matching the following:\n\n{home}/.local/share/sshyp.old\n{home}/.local/" f" matching the following:\n\n{home}/.local/share/sshyp.old\n{home}/.local/"
"share/sshyp.new\n\nare you sure you wish to re-encrypt all entries?") "share/sshyp.new\n\nare you sure you wish to re-encrypt all entries?")
if _sure != 1: if _sure != 1:
return 3 return 3
# set new gpg key # set new gpg key
gpg_config() gpg_config()
@@ -319,7 +319,7 @@ def refresh_encryption():
for _extension in ('.new', '.old'): for _extension in ('.new', '.old'):
if exists(f"{_directory}{_extension}"): if exists(f"{_directory}{_extension}"):
rmtree(f"{_directory}{_extension}") rmtree(f"{_directory}{_extension}")
# decrypt, optimize, and re-encrypt each entry with the newly selected key # decrypt, optimize, and re-encrypt each entry with the newly selected key
if isdir(_directory): if isdir(_directory):
_gpg_id = sshyp_data.get('CLIENT-GENERAL', 'gpg_id') _gpg_id = sshyp_data.get('CLIENT-GENERAL', 'gpg_id')
@@ -329,13 +329,13 @@ def refresh_encryption():
encrypt(decrypt(f"{_root}/{_filename[:-4]}"), encrypt(decrypt(f"{_root}/{_filename[:-4]}"),
f"{_root.replace(_directory, _directory + '.new', 1)}/{_filename[:-4]}", _gpg_id) f"{_root.replace(_directory, _directory + '.new', 1)}/{_filename[:-4]}", _gpg_id)
# create a backup of the original version and activate the new version # create a backup of the original version and activate the new version
move(_directory, _directory + '.old') move(_directory, _directory + '.old')
move(_directory + '.new', _directory) move(_directory + '.new', _directory)
return 1 return 1
else: else:
return 2 return 2
# PORT START WHITELIST-SERVER # PORT START WHITELIST-SERVER
# removes a registered device id from the server-side pool and prunes the quick-unlock whitelist # removes a registered device id from the server-side pool and prunes the quick-unlock whitelist
@@ -426,7 +426,7 @@ def whitelist_manage(_action, _back=False):
# runs quick-unlock configuration menu # runs quick-unlock configuration menu
def whitelist_menu(): def whitelist_menu():
while True: while True:
_choice = curses_radio(('setup/create pin', 'add to whitelist', 'remove from whitelist', _choice = curses_radio(('setup/create pin', 'add to whitelist', 'remove from whitelist',
'BACK'), 'quick-unlock/whitelist management') 'BACK'), 'quick-unlock/whitelist management')
if _choice == 0: if _choice == 0:
whitelist_setup() whitelist_setup()
@@ -564,7 +564,7 @@ def global_menu(_scr, _device_type, _top_message):
dev_id_config(_port, _username_ssh, _ip, _identity) dev_id_config(_port, _username_ssh, _ip, _identity)
# ...or ssh_error is missing # ...or ssh_error is missing
elif not sshyp_data.has_option('CLIENT-ONLINE', 'ssh_error'): elif not sshyp_data.has_option('CLIENT-ONLINE', 'ssh_error'):
sshyp_data.set('CLIENT-ONLINE', 'ssh_error', '1') sshyp_data.set('CLIENT-ONLINE', 'ssh_error', '1')
write_config() write_config()
_device_type = _dev_sync_types[0] _device_type = _dev_sync_types[0]
elif _choice == 1: elif _choice == 1:
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import re import re
targets = (('TWEAK-EXTEND-FUNCTIONS', 'stweak.py', '\n', '\n\n', ''), targets = (('TWEAK-EXTEND-FUNCTIONS', 'stweak.py', '\n', '\n\n', ''),
('TWEAK-EXTEND-OPTION', 'stweak.py', '', '', "curses_radio(['okay'], " ('TWEAK-EXTEND-OPTION', 'stweak.py', '', '', "curses_radio(['okay'], "
"'extension management is not supported on this platform\\\\n\\\\ninstead, you may install and manage " "'extension management is not supported on this platform\\\\n\\\\ninstead, you may install and manage "
"extensions through your system package manager\\\\n\\\\nofficial extension packages are available " "extensions through your system package manager\\\\n\\\\nofficial extension packages are available "