Add --set-yaml switch for setting more complex config file options.

master
Joey Hess 2010-03-24 14:39:50 -04:00
parent 4415686d05
commit c64c4b9962
3 changed files with 17 additions and 3 deletions

1
debian/changelog vendored
View File

@ -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 <joeyh@debian.org> Sat, 13 Mar 2010 14:48:10 -0500

View File

@ -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

View File

@ -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;