From c64c4b99626286ee08f67999a18c43c769e21e6a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Mar 2010 14:39:50 -0400 Subject: [PATCH] Add --set-yaml switch for setting more complex config file options. --- debian/changelog | 1 + doc/usage.mdwn | 10 +++++++--- ikiwiki.in | 9 +++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4d0639a58..e7499b6f2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,7 @@ ikiwiki (3.20100320) UNRELEASED; urgency=low (Thanks to Aaron Wilson for the original patch.) * Allow wrappers to be built using tcc. * Add support for setup files written in YAML. + * Add --set-yaml switch for setting more complex config file options. -- Joey Hess Sat, 13 Mar 2010 14:48:10 -0500 diff --git a/doc/usage.mdwn b/doc/usage.mdwn index f735170f0..db1e36a10 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -331,9 +331,13 @@ also be configured using a setup file. * --set var=value This allows setting an arbitrary configuration variable, the same as if it - were set via a setup file. Since most options can be configured - using command-line switches, you will rarely need to use this, but it can be - useful for the odd option that lacks a command-line switch. + were set via a setup file. Since most options commonly used options can be + configured using command-line switches, you will rarely need to use this. + +* --set-yaml var=value + + This is like --set, but it allows setting configuration variables that + use complex data structures, by passing in a YAML document. # EXAMPLES diff --git a/ikiwiki.in b/ikiwiki.in index da5555629..7028bdb7d 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -96,6 +96,15 @@ sub getconfig () { } $config{$var}=$val; }, + "set-yaml=s" => sub { + my ($var, $val)=split('=', $_[1], 2); + if (! defined $var || ! defined $val) { + die gettext("usage: --set-yaml var=value"), "\n"; + } + eval q{use YAML::Any}; + die $@ if $@; + $config{$var}=Load($val); + }, "version" => sub { print "ikiwiki version $IkiWiki::version\n"; exit; -- 2.26.2