diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/shadacat.py | 23 | ||||
-rwxr-xr-x | scripts/vim-patch.sh | 4 |
2 files changed, 25 insertions, 2 deletions
diff --git a/scripts/shadacat.py b/scripts/shadacat.py index 4ff493bfbc..2f2cf19f9d 100755 --- a/scripts/shadacat.py +++ b/scripts/shadacat.py @@ -60,9 +60,22 @@ def mnormalize(o): fname = sys.argv[1] +try: + filt = sys.argv[2] +except IndexError: + filt = lambda entry: True +else: + _filt = filt + filt = lambda entry: eval(_filt, globals(), {'entry': entry}) + poswidth = len(str(os.stat(fname).st_size or 1000)) +class FullEntry(dict): + def __init__(self, val): + self.__dict__.update(val) + + with open(fname, 'rb') as fp: unpacker = msgpack.Unpacker(file_like=fp, read_size=1) max_type = max(typ.value for typ in EntryTypes) @@ -82,5 +95,15 @@ with open(fname, 'rb') as fp: else: entry = unpacker.unpack() typ = EntryTypes(typ) + full_entry = FullEntry({ + 'value': entry, + 'timestamp': timestamp, + 'time': time, + 'length': length, + 'pos': pos, + 'type': typ, + }) + if not filt(full_entry): + continue print('%*u %13s %s %5u %r' % ( poswidth, pos, typ.name, time.isoformat(), length, mnormalize(entry))) diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index a1b58c7c91..4a567727d8 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -205,8 +205,8 @@ list_vim_patches() { echo " To port one of the above patches to Neovim, execute" echo " this script with the patch revision as argument." echo - echo " Examples: '${BASENAME} 7.4.487'" - echo " '${BASENAME} 1e8ebf870720e7b671f98f22d653009826304c4f'" + echo " Examples: '${BASENAME} -p 7.4.487'" + echo " '${BASENAME} -p 1e8ebf870720e7b671f98f22d653009826304c4f'" } review_pr() { |