remove ThreadConnect func and help fixes

This commit is contained in:
ivan 2022-06-14 11:52:00 +03:00
parent 7d7e2ff775
commit abb2fcfa4c
2 changed files with 10 additions and 12 deletions

View File

@ -13,7 +13,7 @@ def main():
long_description='SSH connection and aliases manager with curses and command line interface', long_description='SSH connection and aliases manager with curses and command line interface',
long_description_content_type='text/x-rst', long_description_content_type='text/x-rst',
license='DWTWL 2.55', license='DWTWL 2.55',
version='1.09.2', version='1.09.3',
py_modules=['sshch'], py_modules=['sshch'],
scripts=['sshch/sshch'], scripts=['sshch/sshch'],
keywords='sshch ssh aliases curses manager', keywords='sshch ssh aliases curses manager',

View File

@ -22,7 +22,7 @@ from curses import textpad, panel
from threading import Thread from threading import Thread
# https://gitlab.com/zlax/sshch # https://gitlab.com/zlax/sshch
version = "1.09.2" version = "1.09.3"
# expand groups by default # expand groups by default
expand_default = True expand_default = True
# path to conf dir and file, default: ~/.config/sshch.conf # path to conf dir and file, default: ~/.config/sshch.conf
@ -39,10 +39,6 @@ class GroupTree(object):
self.parent = [] self.parent = []
def ThreadConnect(alias, command):
ConnectAlias(alias, command, True)
def AddNewAlias(alias): def AddNewAlias(alias):
if not conf.has_section(alias): if not conf.has_section(alias):
conf.add_section(alias) conf.add_section(alias)
@ -227,7 +223,7 @@ def CMDConnect(aliases, command=False, threading=False):
if conf.has_section(alias): if conf.has_section(alias):
print("Connecting to " + alias + "...") print("Connecting to " + alias + "...")
if threading: if threading:
threads[alias] = Thread(target=ThreadConnect, args=(alias, command)) threads[alias] = Thread(target=ConnectAlias, args=(alias, command, True))
threads[alias].start() threads[alias].start()
else: else:
ConnectAlias(alias, command) ConnectAlias(alias, command)
@ -362,7 +358,7 @@ def CursesConnect(screen, aliases, command=False, threading=False):
for alias in connectaliases: for alias in connectaliases:
print("Connecting to " + alias + "...") print("Connecting to " + alias + "...")
if threading: if threading:
threads[alias] = Thread(target=ThreadConnect, args=(alias, command)) threads[alias] = Thread(target=ConnectAlias, args=(alias, command, True))
threads[alias].start() threads[alias].start()
else: else:
ConnectAlias(alias, command) ConnectAlias(alias, command)
@ -466,7 +462,7 @@ def CMDOptions():
"ssh user@somehost.com\n ", "ssh user@somehost.com\n ",
"ssh gates@8.8.8.8 -p 667\n ", "ssh gates@8.8.8.8 -p 667\n ",
"ssh root@somehost.com -t tmux a\n", "ssh root@somehost.com -t tmux a\n",
"Also, you can edit config file manually: ", conf_file, "\n"])) "Also, you can edit the config file manually: ", conf_file, "\n"]))
opts = FormatedParser(usage=usage, version="%prog " + version, opts = FormatedParser(usage=usage, version="%prog " + version,
epilog=epilog) epilog=epilog)
opts.add_option('-l', '--list', action="callback", opts.add_option('-l', '--list', action="callback",
@ -485,7 +481,8 @@ def CMDOptions():
help="execute command for aliases and groups") help="execute command for aliases and groups")
opts.add_option('-t', '--thread', action="store", type="string", opts.add_option('-t', '--thread', action="store", type="string",
dest="thread", metavar="command", default=False, dest="thread", metavar="command", default=False,
help="parallel command execution for aliases and groups") help="parallel command execution for aliases and groups " +
"(ssh key authentication or set password required)" )
opts.add_option('-k', '--keep', action="store", type="string", opts.add_option('-k', '--keep', action="store", type="string",
dest="keep", metavar="alias", default=False, dest="keep", metavar="alias", default=False,
help="hold connection with specified alias") help="hold connection with specified alias")
@ -528,14 +525,15 @@ def CursesMain():
" 'p'/'F6' - set alias's password for sshpass [UNSAFE]\n", " 'p'/'F6' - set alias's password for sshpass [UNSAFE]\n",
" 'space'/'insert' - select\n", " 'space'/'insert' - select\n",
" 'r'/'F8' - remove selected alias/aliases\n", " 'r'/'F8' - remove selected alias/aliases\n",
" 'c'/'F3' - execute specific command with selected alias/aliases\n", " 'c'/'F3' - command execution for alias (group/aliases - in turn)\n",
" 't'/'F11' - parallel command execution for aliases and groups\n", " 't'/'F11' - parallel command execution for aliases and groups\n",
" (ssh key authentication or set password required)\n",
" 'k'/'F7' - hold connection with selected alias\n", " 'k'/'F7' - hold connection with selected alias\n",
" 'enter'/'F9' - connect to selected alias/aliases,\n", " 'enter'/'F9' - connect to selected alias/aliases,\n",
" expand/collapse group\n", " expand/collapse group\n",
" 'q'/'F10' - quit\n", " 'q'/'F10' - quit\n",
" Run program with '--help' option to view command line help.\n", " Run program with '--help' option to view command line help.\n",
" Also, you can edit config file manually:\n", " Also, you can edit the config file manually:\n",
" ", conf_file])) " ", conf_file]))
if expand_default == True: if expand_default == True:
groups = [] groups = []