diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-29 20:23:38 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-29 20:23:38 -0500 |
commit | 6d1ce7ae47343251af3db9ddc6fd67f72352a9e7 (patch) | |
tree | 2c79353621f50e3b06a46e73fe7e8fc2455848ba | |
parent | ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f (diff) | |
download | cmd2-git-6d1ce7ae47343251af3db9ddc6fd67f72352a9e7.tar.gz |
Fixed issue with automated transcript generation via "history -t"
There is now a post-processing step which escapes all "/" characters which transcript testing treats as a regex escape if there isn't a "\" to esape it.
-rwxr-xr-x | cmd2.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1913,6 +1913,13 @@ a..b, a:b, a:, ..b items by indices (inclusive) # Set echo back to its original state self.echo = saved_echo + # Post-process the file to escape un-escaped "/" regex escapes + with open(args.transcript, 'r') as fin: + data = fin.read() + post_processed_data = data.replace('/', '\/') + with open(args.transcript, 'w') as fout: + fout.write(post_processed_data) + plural = 's' if len(history) > 1 else '' self.pfeedback('{} command{} and outputs saved to transcript file {!r}'.format(len(history), plural, args.transcript)) |