Fix -f cmd output

This commit is contained in:
ivan 2021-09-22 18:19:17 +03:00
parent 10ca6ad15b
commit 7fa8bdb6f9
1 changed files with 4 additions and 6 deletions

View File

@ -20,7 +20,7 @@ import curses
from curses import textpad, panel from curses import textpad, panel
# https://gitlab.com/zlax/sshch # https://gitlab.com/zlax/sshch
version = "1.07" version = "1.08"
# 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
@ -285,14 +285,10 @@ def GroupTreeRecursion(level, group, treelist, resultalias, resultstring, expand
return resultalias, resultstring return resultalias, resultstring
previousgroups.append(group) previousgroups.append(group)
resultalias.append(group) resultalias.append(group)
if group in expandlist:
resultstring.append(' '*(level-1)+">> "+group)
else:
resultstring.append(' '*(level-1)+"<> "+group)
if expandlist == True or group in expandlist: if expandlist == True or group in expandlist:
resultstring.append(' '*(level-1)+">> "+group)
for g in treelist[group].children: for g in treelist[group].children:
resultalias, resultstring = GroupTreeRecursion(level+1, g, treelist, resultalias, resultstring, expandlist, previousgroups) resultalias, resultstring = GroupTreeRecursion(level+1, g, treelist, resultalias, resultstring, expandlist, previousgroups)
if expandlist == True or group in expandlist:
for ga in treelist[group].aliases: for ga in treelist[group].aliases:
if conf.has_option(ga, "exec_string"): if conf.has_option(ga, "exec_string"):
resultalias.append(ga) resultalias.append(ga)
@ -300,6 +296,8 @@ def GroupTreeRecursion(level, group, treelist, resultalias, resultstring, expand
conf.has_option(ga, "exec_string") else ""), ")", conf.has_option(ga, "exec_string") else ""), ")",
(" [password]" if conf.has_option(ga, "password") else "")]) (" [password]" if conf.has_option(ga, "password") else "")])
resultstring.append(result) resultstring.append(result)
else:
resultstring.append(' '*(level-1)+"<> "+group)
return resultalias, resultstring return resultalias, resultstring