From b1e877c79a61e43c152eb19e86b941f584de20a1 Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Tue, 20 Apr 2021 21:44:29 -0600 Subject: [PATCH] cog: add -O/--platform-options command line option Adds ability to directly pass parameters to the platform plugins. Example: cog --platform FOO --platform-options "bar=1,baz" https://example.com cog -P FOO -O "bar=1,baz" https://example.com The option syntax is platform-plugin dependant. Current platform plugins (drm,x11,fdo,headless) do not support any options. --- cog.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cog.c b/cog.c index 49aa3f19..caa64137 100644 --- a/cog.c +++ b/cog.c @@ -42,6 +42,7 @@ static struct { } on_failure; char *web_extensions_dir; gboolean ignore_tls_errors; + char *platform_options; } s_options = { .scale_factor = 1.0, .device_scale_factor = 1.0, @@ -83,6 +84,9 @@ static GOptionEntry s_cli_options[] = { "platform", 'P', 0, G_OPTION_ARG_STRING, &s_options.platform_name, "Platform plug-in to use.", "NAME" }, + { "platform-options", 'O', 0, G_OPTION_ARG_STRING, &s_options.platform_options, + "custom options to pass to the platform shared object", + "OPT,OPT=VALUE" }, { "web-extensions-dir", '\0', 0, G_OPTION_ARG_STRING, &s_options.web_extensions_dir, "Load Web Extensions from given directory.", "PATH"}, @@ -306,7 +310,7 @@ platform_setup (CogShell *shell) } g_autoptr(GError) error = NULL; - if (!cog_platform_setup (platform, shell, "", &error)) { + if (!cog_platform_setup (platform, shell, s_options.platform_options, &error)) { g_warning ("Platform setup failed: %s", error->message); return FALSE; }