Add scripts folder for any useful scripts to work on code.

These scripts are not distributed with Geany, and are only in SVN.
Add changelist.pl to group and reverse ChangeLog entries, useful for writing NEWS.
Add missing-mnemonics.sh, to search for missing menu item mnemonics.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2433 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-04-01 12:53:26 +00:00
parent 145b03bfff
commit 0d68f8e2df
2 changed files with 66 additions and 0 deletions

54
scripts/changelist.pl Executable file
View File

@ -0,0 +1,54 @@
#!/usr/bin/perl -w
# Author: Nick Treleaven
# License: GPL V2 or later
# Searches a ChangeLog file for a line matching 'matchstring', then matches
# all lines until two consecutive empty lines are found. The process then
# repeats until all matching blocks of text are found.
# Results are printed in reverse, hence in chronological order (as ChangeLogs
# are usually written in reverse date order).
use strict;
my $scriptname = "changelist";
my $argc = $#ARGV + 1;
($argc == 2)
or die "Usage:\n$scriptname matchstring changelogfile\n";
my ($matchstr, $infile) = @ARGV;
open(INPUT, $infile)
or die "Couldn't open $infile for reading: $!\n";
my $entry; # the current matching block of text
my @entries;
my $found = 0; # if we're in a matching block of text
my $blank = 0; # whether the last line was empty
while (<INPUT>) {
my $line = $_; # read a line, including \n char
if (! $found) {
($line =~ m/$matchstr/) and $found = 1;
} else {
if (length($line) <= 1) # current line is empty
{
if ($blank > 0) { # previous line was also empty
push(@entries, $entry); # append entry
$entry = "";
$found = 0; # now look for next match
$blank = 0;
}
else {
$blank = 1;
}
}
}
$found and $entry .= $line;
}
close(INPUT);
foreach $entry (reverse @entries) {
print "$entry\n\n";
}

12
scripts/missing-mnemonics.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# Author: Nick Treleaven
# License: GPL V2 or later
# Usage: check-mnemonics.sh [file list]
if [[ $1 == '' ]]; then
FILES='src/*.c plugins/*.c'
else
FILES=$1
fi
fgrep -n 'menu_item_new' $FILES |egrep -v '".*_[a-zA-Z0-9]' |fgrep -v from_stock |fgrep -v '_("No custom commands defined.")' |fgrep -vi '_("invisible")' |egrep '_\(".+' --color