mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-11-16 13:35:39 +01:00
When -n/--no-colors is used, strip out color from Windows man page.
This commit is contained in:
parent
36094611ce
commit
ef831d17e0
@ -28,6 +28,7 @@ import copy
|
|||||||
import getopt
|
import getopt
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
@ -603,6 +604,7 @@ def process_commandline(out: OutputBuffer, args: List[str], usage_cb: Callable[.
|
|||||||
aconf.client_audit = True
|
aconf.client_audit = True
|
||||||
elif o in ('-n', '--no-colors'):
|
elif o in ('-n', '--no-colors'):
|
||||||
aconf.colors = False
|
aconf.colors = False
|
||||||
|
out.use_colors = False
|
||||||
elif o in ('-j', '--json'):
|
elif o in ('-j', '--json'):
|
||||||
aconf.json = True
|
aconf.json = True
|
||||||
elif o in ('-v', '--verbose'):
|
elif o in ('-v', '--verbose'):
|
||||||
@ -1007,7 +1009,12 @@ def windows_manual(out: OutputBuffer) -> int:
|
|||||||
retval = exitcodes.FAILURE
|
retval = exitcodes.FAILURE
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
out.info(WINDOWS_MAN_PAGE)
|
# If colors are disabled, strip the ANSI color codes from the man page.
|
||||||
|
windows_man_page = WINDOWS_MAN_PAGE
|
||||||
|
if not out.use_colors:
|
||||||
|
windows_man_page = re.sub(r'\x1b\[\d+?m', '', windows_man_page)
|
||||||
|
|
||||||
|
out.info(windows_man_page)
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user