r101759 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101758‎ | r101759 | r101760 >
Date:00:20, 3 November 2011
Author:amire80
Status:ok
Tags:
Comment:
Added documentation and fixed eol-style.
Modified paths:
  • /trunk/tools/webfonts-tools/webfonts-mover.pl (modified) (history)

Diff [purge]

Index: trunk/tools/webfonts-tools/webfonts-mover.pl
@@ -1,4 +1,8 @@
22 #!/usr/bin/perl
 3+# webfonts-mover.pl
 4+# A simple program to uninstall and install WebFonts.
 5+# run perl webfonts-mover.pl --help for more information.
 6+# Author: Amir E. Aharoni
37
48 use 5.010;
59
@@ -27,18 +31,47 @@
2832 my $system_fonts_dir = '/usr/share/fonts';
2933 my $dry = 0;
3034 my $restore = 0;
 35+my $help = 0;
3136
3237 my $getopt_success = GetOptions(
3338 'source_fonts_dir=s' => \$source_fonts_dir,
3439 'removed_fonts_dir=s' => \$removed_fonts_dir,
3540 'dry' => \$dry,
3641 'restore' => \$restore,
 42+ 'help' => \$help,
3743 );
3844
3945 if (not $getopt_success) {
4046 croak('Fatal error reading command-line options. Exiting.');
4147 }
4248
 49+if ($help) {
 50+ say <<"END_USAGE";
 51+This programs moves font files that have the same names as in the WebFonts
 52+extension out of the system fonts directory to a backup directory
 53+or restores them back. After moving the files it rebuild the cache by
 54+running fc-cache.
 55+
 56+Notes:
 57+* Currently it only works on Linux.
 58+* You probably need to run it as a superuser.
 59+* It's a very preliminary version. Consider backing up your fonts directory.
 60+
 61+Command line options:
 62+--source_fonts_dir The fonts directory in the WebFonts source tree.
 63+ The default is ../../extensions/WebFonts/fonts.
 64+--removed_fonts_dir The destination directory for removed web fonts.
 65+ The default is ./removed_fonts.
 66+--dry Don't move files or update the cache.
 67+ Only show which files would be moved and on which
 68+ directories fc-cache would run.
 69+--restore Moved font files back to the system fonts directory.
 70+ Default is false.
 71+--help Print this help message.
 72+END_USAGE
 73+ exit;
 74+}
 75+
4376 $source_fonts_dir = abs_path($source_fonts_dir);
4477
4578 File::Find::find(\&source_fonts, $source_fonts_dir);
Property changes on: trunk/tools/webfonts-tools/webfonts-mover.pl
___________________________________________________________________
Added: svn:eol-style
4679 + native

Status & tagging log