From e6eeab60946e61047ed858422badbda189a6f9e8 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 25 Apr 2017 19:06:24 +1200 Subject: Revamp how addons work - Addons now nest, which means that addons can manage addons. This has a number of salutary effects - the scripts addon no longer has to poke into the global addons list, we no longer have to replace/remove/boot-outof parent addons when we load scripts, and this paves the way for making our top-level tools into addons themselves. - All addon calls are now wrapped in a safe execution environment where exceptions are caught, and output to stdout/stderr are intercepted and turned into logs. - We no longer support script arguments in sys.argv - creating an option properly is the only way to pass arguments. This means that all scripts are always directly controllable from interctive tooling, and that arguments are type-checked. For now, I've disabled testing of the har dump example - it needs to be moved to the new argument handling, and become a class addon. I'll address that in a separate patch. --- examples/simple/script_arguments.py | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 examples/simple/script_arguments.py (limited to 'examples/simple/script_arguments.py') diff --git a/examples/simple/script_arguments.py b/examples/simple/script_arguments.py deleted file mode 100644 index 84292eb9..00000000 --- a/examples/simple/script_arguments.py +++ /dev/null @@ -1,17 +0,0 @@ -import argparse - - -class Replacer: - def __init__(self, src, dst): - self.src, self.dst = src, dst - - def response(self, flow): - flow.response.replace(self.src, self.dst) - - -def load(l): - parser = argparse.ArgumentParser() - parser.add_argument("src", type=str) - parser.add_argument("dst", type=str) - args = parser.parse_args() - l.boot_into(Replacer(args.src, args.dst)) -- cgit v1.2.3