diff --git a/tools/generate-integration-docs-screenshot b/tools/generate-integration-docs-screenshot index 2ef7d29635..9acc395fd3 100755 --- a/tools/generate-integration-docs-screenshot +++ b/tools/generate-integration-docs-screenshot @@ -252,7 +252,11 @@ def generate_screenshot_from_config( parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group(required=True) group.add_argument("--all", action="store_true") -group.add_argument("--integration", help="Name of the integration") +group.add_argument( + "--skip-until", help="Name of the integration whose predecessor are skipped. Similar to --all" +) +group.add_argument("--integration", nargs="+", help="Names of the integrations") +fixture_group = parser.add_argument_group("integration") parser.add_argument("--fixture", help="Name of the fixture file to use") parser.add_argument("--image-name", help="Name for the screenshot image") parser.add_argument("--image-dir", help="Directory name where to save the screenshot image") @@ -281,11 +285,32 @@ if options.all: for key, value in vars(options).items(): if key != "all" and value: print("Generating screenshots for all integrations. Ignoring all command-line options") + break for integration_name, screenshot_configs in DOC_SCREENSHOT_CONFIG.items(): for screenshot_config in screenshot_configs: generate_screenshot_from_config(integration_name, screenshot_config) +elif options.skip_until: + for key, value in vars(options).items(): + if key != "skip_until" and value: + print( + f"Generating screenshots for all integrations skipping until {options.skip_until}. Ignoring all command-line options" + ) + break + skip = True + for integration_name, screenshot_configs in DOC_SCREENSHOT_CONFIG.items(): + if integration_name == options.skip_until: + skip = False + if skip: + continue + for screenshot_config in screenshot_configs: + generate_screenshot_from_config(integration_name, screenshot_config) + elif options.fixture: + if len(options.integration) != 1: + parser.error( + "Exactly one integration should be specified for --integration when --fixture is provided" + ) config = dict( fixture_name=options.fixture, use_basic_auth=options.use_basic_auth, @@ -301,12 +326,14 @@ elif options.fixture: if options.payload_param_name: config["payload_param_name"] = options.payload_param_name screenshot_config = ScreenshotConfig(**config) - generate_screenshot_from_config(options.integration, screenshot_config) + generate_screenshot_from_config(options.integration[0], screenshot_config) -elif options.integration in DOC_SCREENSHOT_CONFIG: - configs = DOC_SCREENSHOT_CONFIG[options.integration] - for screenshot_config in configs: - generate_screenshot_from_config(options.integration, screenshot_config) +elif options.integration: + for integration in options.integration: + assert integration in DOC_SCREENSHOT_CONFIG + configs = DOC_SCREENSHOT_CONFIG[integration] + for screenshot_config in configs: + generate_screenshot_from_config(integration, screenshot_config) else: parser.error(