archive- Random tools & helpful resources for IRC |
git clone git://git.acid.vegas/archive.git |
Log | Files | Refs | Archive |
coloconv.pl (1035B)
1 #!/usr/bin/perl 2 3 =pod 4 5 Reads plugins.conf from stdin, writes new plugins.conf to stdout, and 6 writes commands to restore the rest of the config options to stderr 7 8 Suggested operation: 9 cd .weechat 10 ./coloconv.pl < plugins.conf > plugins.conf.new 2> commands 11 diff plugins.conf plugins.conf.new # to make sure nothing got clobbered 12 13 Then in WeeChat: 14 /exec -o .weechat/commands 15 16 =cut 17 18 my %profs; 19 my $desc = 0; 20 21 while (<>) { 22 $desc and print, next; 23 $_ !~ /^python\.embellish\./ and print, next; 24 s/^python\.embellish/python.colo/; 25 $_ !~ /^python\.colo\..*(?:pre|suf)/ and print, next; 26 $_ eq '[desc]' and ($desc = 1), print, next; 27 28 my ($prof, $k, $v) = /^python\.colo\.(.*)(pre|suf) = "(.*)"$/; 29 $v =~ s/\x02/%b/g; 30 $v =~ s/\x03/%c/g; 31 $v =~ s/\x0f/%o/g; 32 $v =~ s/\x16/%r/g; 33 $v =~ s/\x1f/%u/g; 34 35 if ($k eq 'pre') { 36 $profs{$prof} = "%0$v%o%0 %s%o%0 "; 37 } elsif ($k eq 'suf') { 38 $profs{$prof} .= $v; 39 } 40 } 41 42 for my $prof (keys %profs) { 43 print STDERR "/reload\n"; 44 print STDERR "/set plugins.var.python.colo.${prof}fmt $profs{$prof}\n"; 45 }