Skip to content

Commit 2d0a17e

Browse files
committed
Add --verbose option
Currently just controls printing a moderator list when listing rooms, but probably will be used for other things in the future.
1 parent ffcf8c3 commit 2d0a17e

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

sogs/__main__.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
from . import crypto
1010
from . import logging # noqa: F401
1111

12-
ap = AP(epilog="""
12+
ap = AP(
13+
epilog="""
1314
1415
Examples:
1516
@@ -25,7 +26,9 @@
2526
# List room info:
2627
python3 -msogs -L
2728
28-
""", formatter_class=RawDescriptionHelpFormatter) # noqa: E501
29+
""", # noqa: E501
30+
formatter_class=RawDescriptionHelpFormatter,
31+
)
2932

3033
actions = ap.add_mutually_exclusive_group()
3134

@@ -80,6 +83,9 @@
8083
actions.add_argument(
8184
'--list-global-mods', '-M', action='store_true', help="List global moderators/admins"
8285
)
86+
ap.add_argument(
87+
"--verbose", "-v", action='store_true', help="Show more information for some commands"
88+
)
8389
ap.add_argument(
8490
"--yes", action='store_true', help="Don't prompt for confirmation for some commands, just do it"
8591
)
@@ -109,16 +115,21 @@ def print_room(room: model.Room):
109115
Messages: {msgs} ({msgs_size:.1f} MB)
110116
Attachments: {files} ({files_size:.1f} MB)
111117
Active users: {active[0]} (7d), {active[1]} (14d) {active[2]} (30d)
112-
Moderators: {admins} admins ({len(ha)} hidden), {mods} moderators ({len(hm)} hidden):"""
118+
Moderators: {admins} admins ({len(ha)} hidden), {mods} moderators ({len(hm)} hidden)""",
119+
end='',
113120
)
114-
for id in a:
115-
print(f" - {id} (admin)")
116-
for id in ha:
117-
print(f" - {id} (hidden admin)")
118-
for id in m:
119-
print(f" - {id} (moderator)")
120-
for id in hm:
121-
print(f" - {id} (hidden moderator)")
121+
if args.verbose and any((m, a, hm, ha)):
122+
print(":")
123+
for id in a:
124+
print(f" - {id} (admin)")
125+
for id in ha:
126+
print(f" - {id} (hidden admin)")
127+
for id in m:
128+
print(f" - {id} (moderator)")
129+
for id in hm:
130+
print(f" - {id} (hidden moderator)")
131+
else:
132+
print()
122133

123134

124135
db.conn = db.sqlite_connect()

0 commit comments

Comments
 (0)