From ba480baa9ec9e2d5d04c6eb06fd3ab4dafd60794 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 15 Mar 2008 14:19:49 -0400 Subject: * external: Add getargv and setargv methods to allow access to ikiwiki's @ARGV. --- ...ternal_plugins_cannot_access_ARGV_needed_for_getopt.mdwn | 13 +++++++++++++ doc/plugins/write/external.mdwn | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/bugs/external_plugins_cannot_access_ARGV_needed_for_getopt.mdwn b/doc/bugs/external_plugins_cannot_access_ARGV_needed_for_getopt.mdwn index cc82d1cd7..be7f16a79 100644 --- a/doc/bugs/external_plugins_cannot_access_ARGV_needed_for_getopt.mdwn +++ b/doc/bugs/external_plugins_cannot_access_ARGV_needed_for_getopt.mdwn @@ -1 +1,14 @@ The `getopt` hook expects plugins to modify `@ARGV`. This is not exported via xml-rpc and thus external plugins cannot do anything. --[[madduck]] + +> I can think of two interfaces to handle this. +> +> 1. Pass @ARGV to the hook, and remove any values the hook returns from @ARGV. +> 2. Provide an XML-RPC interface for setting and getting ikiwiki's @ARGV. +> +> The first is simpler, but requires keeping track of which options to +> remove, which could be a pain, and probably precludes using regular +> getopt libraries to process options. It also could theoretically cause +> problems for existing perl getopt hooks. +> +> The second should allow using regular getopt libraries, but does bloat +> the RPC interface. Oh well, guess that's ok. [[done]] --[[Joey]] diff --git a/doc/plugins/write/external.mdwn b/doc/plugins/write/external.mdwn index fd343bda6..2ee841e61 100644 --- a/doc/plugins/write/external.mdwn +++ b/doc/plugins/write/external.mdwn @@ -53,6 +53,9 @@ it, external plugins can use the `getstate` and `setstate` RPCs. To access stored state, call `getstate("page", "id", "key")`, and to store state, call `setstate("page", "id", "key", "value")`. +To access ikiwiki's ARGV, call `getargv()`. To change its ARGV, call +`setargv(value)`. + ## Notes on function parameters The [[plugin_interface_documentation|write]] talks about functions that take @@ -99,9 +102,6 @@ with functions that take or return such references. That means you can't FormBuilder perl objects), or use it to call `template()` (which returns a perl HTML::Template object). -Also. the `getopt` hook doesn't work, as ARGV is not available to the external -plugin. - ## Performance issues Since each external plugin is a separate process, when ikiwiki is -- cgit v1.2.3