add option to invert regex filter results

Jeff Becker 2021-07-02 09:01:14 -04:00
parent 3893a94e07
commit 8f4c23ef47
Signed by untrusted user who does not match committer: jeff
GPG Key ID: F357B3B42F6F9B05
1 changed files with 4 additions and 1 deletions

View File

@ -560,6 +560,7 @@ def main():
ap.add_argument("--introset", action='store_const', const=True, default=False, help="run in introset inspection mode")
ap.add_argument("--url", default='tcp://', type=str, help='url to lokinet rpc')
ap.add_argument('--filter', default='.+', type=str, help="regex to filter entries")
ap.add_argument('--invert-filter', const=True, default=False, action='store_const', help='invert regex filter matching')
args = ap.parse_args()
@ -567,8 +568,10 @@ def main():
mon.filter = lambda x : re.match(args.filter, x) is not None
if args.invert_filter:
old_filter = mon.filter
mon.filter = lambda x : not old_filter(x)
if __name__ == "__main__":