help=('temporary test directory to combine logs from. '
'Defaults to the most recent'))
parser.add_argument('-c','--color',dest='color',action='store_true',help='outputs the combined log with events colored by source (requires posix terminal colors. Use less -r for viewing)')
parser.add_argument('--html',dest='html',action='store_true',help='outputs the combined log as html. Requires jinja2. pip install jinja2')
args,unknown_args=parser.parse_known_args()
args=parser.parse_args()
ifargs.htmlandargs.color:
print("Only one out of --color or --html should be specified")
sys.exit(1)
# There should only be one unknown argument - the path of the temporary test directory
iflen(unknown_args)!=1:
print("Unexpected arguments"+str(unknown_args))
testdir=args.testdirorfind_latest_test_dir()
ifnottestdir:
print("No test directories found")
sys.exit(1)
log_events=read_logs(unknown_args[0])
ifnotargs.testdir:
print("Opening latest test directory: {}".format(testdir),file=sys.stderr)