summaryrefslogtreecommitdiff
path: root/pinyadmin
diff options
context:
space:
mode:
authorJulian Blake Kongslie <jblake@omgwallhack.org>2011-04-20 21:49:06 -0700
committerJulian Blake Kongslie <jblake@omgwallhack.org>2011-04-20 21:49:06 -0700
commitd2977669bb388de0a991af6548427e896550e646 (patch)
tree979c4f0eccc19d889f8dbdba5df18b75b5124048 /pinyadmin
parentff8b5180562a90f5f44447c627f86ab60467f55e (diff)
downloadpiny-code-d2977669bb388de0a991af6548427e896550e646.tar.gz
piny-code-d2977669bb388de0a991af6548427e896550e646.zip
Allow changes to .gitconfig using pinyconfig interface.
Diffstat (limited to 'pinyadmin')
-rwxr-xr-xpinyadmin/sbin/pinyconfig16
1 files changed, 11 insertions, 5 deletions
diff --git a/pinyadmin/sbin/pinyconfig b/pinyadmin/sbin/pinyconfig
index f6752db..4b6f84b 100755
--- a/pinyadmin/sbin/pinyconfig
+++ b/pinyadmin/sbin/pinyconfig
@@ -8,30 +8,36 @@ use Piny;
my ( $reponame, $attr, $value ) = @ARGV;
if ( not defined $reponame or not defined $attr ) {
- die "Usage: $0 reponame tweakable [value]\n";
+ die "Usage: $0 reponame|--user tweakable [value]\n";
};
$attr = lc $attr;
$attr =~ s/\./_/g;
-my $repo = Piny::Repo->new( $reponame );
+my $config;
+
+if ( $repo eq "--user" ) {
+ $config = Piny::Environment->instance->user->config;
+} else {
+ $config = Piny::Repo->new( $reponame )->config;
+};
if ( defined $value ) {
undef $@;
eval {
- $repo->config->$attr( $value );
+ $config->$attr( $value );
};
if ( $@ ) {
print STDERR "$attr is not a legal tweakable, or $value is not a legal value for that tweakable.\n$@\n";
};
- if ( $value ne $repo->config->$attr ) {
+ if ( $value ne $config->$attr ) {
print STDERR "Failed to set $attr (perhaps an override is in place)\n";
};
};
undef $@;
eval {
- print "$attr = " . $repo->config->$attr . "\n";
+ print "$attr = " . $config->$attr . "\n";
};
if ( $@ ) {
print STDERR "$attr is not a legal tweakable, or its current value is illegal.\n$@\n";