aboutsummaryrefslogtreecommitdiffstats
path: root/copypage.pl
diff options
context:
space:
mode:
authorHans Fredrik Nordhaug <hansfn-guest>2021-01-03 10:17:07 +0100
committerHans Fredrik Nordhaug <hansfn-guest>2021-01-03 10:21:25 +0100
commitbfd8b730be2e332954df37a62e9a63e429e064cc (patch)
treec38c88e82f97db51e65dd01aee7478ed9a89e95f /copypage.pl
parent0923cca7c0ec7ee13939df23689271191e6dd754 (diff)
Updated copypage.pl usage and removed errors / warnings when it is run without arguments.
Also removed remaining code for and info about the "-n" option that was removed in May 2018.
Diffstat (limited to 'copypage.pl')
-rwxr-xr-xcopypage.pl31
1 files changed, 18 insertions, 13 deletions
diff --git a/copypage.pl b/copypage.pl
index 88dd0295981..bc83c5413eb 100755
--- a/copypage.pl
+++ b/copypage.pl
@@ -43,7 +43,9 @@ if (open CONF, "<language.conf")
}
else
{
- warn "Unable to open language.conf. Using environment variables/command-line switches ...\n";
+ # Running the script with no arguments should display usage without warnings/errors.
+ warn "Unable to open language.conf. Using environment variables/command-line switches ...\n"
+ unless $#ARGV == -1;
}
# Values are overwritten by environment variables
@@ -59,8 +61,8 @@ if (exists $ENV{DWWW_MAINT})
my $VCS = Local::VCS->new();
# Options
-our ($opt_n, $opt_t, $opt_l);
-getopts('nm:l:');
+our ($opt_t, $opt_l);
+getopts('m:l:');
# Values overwritten by commandline
if (defined $opt_m)
@@ -75,28 +77,31 @@ if (defined $opt_l)
# Check usage.
if ($#ARGV == -1)
{
- print "Usage: $0 [-n] [-l language] [-m maintainer] page ...\n\n";
+
+ $language = "<language>" if not defined $language;
+
+ print "Usage: $0 [-l language] [-m maintainer] page ...\n\n";
print "Copies the page from the english/ directory to the $language/ directory\n";
print "and adds the translation-check header with the current revision,\n";
print "optionally adds also the maintainer name.\n";
print "If the directory does not exist, it will be created, and the Makefile\n";
- print "copied or created, depending on the setting of your language.conf file.\n\n";
+ print "copied or created, depending on the setting of your language.conf file.\n";
+ print "If the file already exists in the $language/ directory\n";
+ print "the file will be skipped and the user warned.\n\n";
print "The 'english/' part of the input path is optional.\n\n";
- print "If the file already exists in the $language/ repository either\n";
- print "because it was removed (and is in the Attic) or has been removed\n";
- print "locally the program will abort and warn the user (unless '-n' is used)\n";
- print "Environment variables:\n";
+ print "Environment variables (which overwrites language.conf):\n";
print "\tDWWW_LANG\tSets the language for the translation\n";
- print "\t\t(overwrites language.conf definition\n";
print "\tDWWW_MAINT\tSets maintainer for the translation\n";
print "Options:\n";
- print "\t-m\tSets the maintainer for the translation (overwrites environment)\n";
- print "\t-l\tSets the language for the translation (overwrites environment)\n";
+ print "\t-m\tSets the maintainer for the translation (overwrites everything)\n";
+ print "\t-l\tSets the language for the translation (overwrites everything)\n";
print "\n";
+ # Exit immediately as there is nothing to do.
+ exit
}
-die "Language not defined in DWWW_LANG or language.conf\n"
+die "Language not defined in language.conf, DWWW_LANG or command-line switch\n"
if not defined $language;
#warn "Maintainer name not defined in DWWW_MAINT or language.conf\n"

© 2014-2024 Faster IT GmbH | imprint | privacy policy