From 77a280d36dfa31d6bcc95f6469800c1c5a20d29d Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Wed, 13 Oct 2010 10:29:26 -0700 Subject: Documentation. --- usr/src/pinyadmin/bin/pinyconfig | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'usr/src/pinyadmin/bin/pinyconfig') diff --git a/usr/src/pinyadmin/bin/pinyconfig b/usr/src/pinyadmin/bin/pinyconfig index ec8e80a..e18ac30 100755 --- a/usr/src/pinyadmin/bin/pinyconfig +++ b/usr/src/pinyadmin/bin/pinyconfig @@ -7,12 +7,28 @@ use Piny; my ( $reponame, $attr, $value ) = @ARGV; +if ( not defined $reponame or not defined $attr ) { + die "Usage: $0 reponame tweakable [value]\n"; +}; + $attr =~ s/\./_/g; my $repo = Piny::Repo->new( $reponame ); if ( defined $value ) { - $repo->config->$attr( $value ); + undef $@; + eval { + $repo->config->$attr( $value ); + }; + if ( defined $@ ) { + print STDERR "$attr is not a legal tweakable, or $value is not a legal value for that tweakable.\n$@\n"; + }; }; -print "$attr = " . $repo->config->$attr . "\n"; +undef $@; +eval { + print "$attr = " . $repo->config->$attr . "\n"; +}; +if ( defined $@ ) { + print STDERR "$attr is not a legal tweakable, or its current value is illegal.\n$@\n"; +}; -- cgit v1.2.3