Skip to content

Commit

Permalink
cog: add -O/--platform-options command line option
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
agordon committed Apr 23, 2021
1 parent e21e329 commit b1e877c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"},
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b1e877c

Please sign in to comment.