[Geany-Devel] Accessing argv from plugins

Lex Trotman elextr at gmail.com
Mon Jan 7 23:34:04 UTC 2013

On 8 January 2013 02:19, Colomban Wendling <lists.ban at herbesfolles.org> wrote:
> Le 07/01/2013 10:25, Matthew Brush a écrit :
>> Hi,
>> I want to write a plugin that requires some command line options passed
>> to it (through geany). Is there a way to make it so Geany will accept
>> arbitrary arguments and then I can pick them out of /proc/<PID>/cmdline
>> or something[1]? I tried but Geany currently errors out if it sees an
>> option it does not recognize itself.
>> Assuming this is not possible currently, is there any sane way to pass
>> arguments to plugins, maybe something like how you can pass `-Wl` to GCC
>> to pass-through linker args or `-X` to valac to pass-through compiler args?
> It's not currently possible, but if you want to implement this, using
> GOption's groups is the way to go.  Though, we parse arguments long
> before loading the plugins, so maybe it'd be a bit hard to make it fit…

Yeah, that is why I suggested all the "plugin" arguments are a single
defined option with the plugin option name and value in a string value
for the -X.  The plugins are responsible for parsing all of whatever
was passed to -X, probably easiest with regex if you are parsing lots
of them, but strncmp would work simply too.

Sadly my quick read of g_option stuff doesn't seem it supports
multiple occurances of an arg, so all the plugin args should be in one
-X, still given how popular this has been to date few plugins will
need cl options, most use friendly keyfiles. :)


More information about the Devel mailing list