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?
Cheers, Matthew Brush
[1] I'm not opposed to hacks or Linux-specific workarounds.
On 7 January 2013 20:25, Matthew Brush mbrush@codebrainz.ca wrote:
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?
There is always (shuddddder) environment vars if you don't want to modify Geany.
Or you could add a multi-occurance option that takes string values, the -X sounds good (X for extensions == plugins). Make all the values available to plugins (GSlist maybe) which can pick and choose what they want.
So you get:
geany -X="plugin_name-option_name=value" -X="plugin2name-another_option=value" files
Cheers Lex
Cheers, Matthew Brush
[1] I'm not opposed to hacks or Linux-specific workarounds. _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
On 13-01-07 03:46 AM, Lex Trotman wrote:
On 7 January 2013 20:25, Matthew Brush mbrush@codebrainz.ca wrote:
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?
There is always (shuddddder) environment vars if you don't want to modify Geany.
In this case I need a command to pass to 3rd party library that will itself launch Geany and give it some arguments (meant to be handled by the plugin). I don't think it'd work with env vars.
Or you could add a multi-occurance option that takes string values, the -X sounds good (X for extensions == plugins). Make all the values available to plugins (GSlist maybe) which can pick and choose what they want.
So you get:
geany -X="plugin_name-option_name=value" -X="plugin2name-another_option=value" files
Yep, that's pretty much what I was figuring for this use. Anyone know what kind of PITA it would be to implement? I can guess "somewhat of a" but I've not really looked into the code yet.
Cheers, Matthew Brush
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… however, IIRC it's totally possible not to error out on unknown arguments and then it'd be possible to re-parse what's left in argv after deciding whether or not to load plugins.
Though, of course CL args are great, but why do you plugin need them? Just curious.
Cheers, Colomban
Cheers, Matthew Brush
[1] I'm not opposed to hacks or Linux-specific workarounds. _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
On Mon, 07 Jan 2013 16:19:05 +0100 Colomban Wendling lists.ban@herbesfolles.org wrote:
Le 07/01/2013 10:25, Matthew Brush a écrit :
I want to write a plugin that requires some command line options passed to it (through geany). [...]
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… however, IIRC it's totally possible not to error out on unknown arguments and then it'd be possible to re-parse what's left in argv after deciding whether or not to load plugins.
Woudn't it be easier to catch all -X in parse_command_line_options(), like +NNN, store them in a list, and free on exit?
On 8 January 2013 02:19, Colomban Wendling lists.ban@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. :)
Cheers Lex
On Tue, 8 Jan 2013 10:34:04 +1100 Lex Trotman elextr@gmail.com wrote:
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. :)
G_OPTION_ARG_STRING_ARRAY The option takes a string argument, multiple uses of the option are collected into an array of strings.