[pacman-dev] [PATCH] makepkg-template: add --version and some license info
Signed-off-by: Florian Pritz <bluewind@xinu.at> --- scripts/makepkg-template.pl.in | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/scripts/makepkg-template.pl.in b/scripts/makepkg-template.pl.in index 7e37799..f3eda05 100755 --- a/scripts/makepkg-template.pl.in +++ b/scripts/makepkg-template.pl.in @@ -1,4 +1,22 @@ #!/usr/bin/perl +# makepkg-template - template system for makepkg +# @configure_input@ +# +# Copyright (c) 2013 Pacman Development Team <pacman-dev@archlinux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# use warnings; use strict; use v5.10.1; @@ -158,14 +176,27 @@ sub usage { print gettext(" (default: use version specified in the template markers)\n"); print gettext(" --template-dir <dir> directory to search for templates\n"); printf(gettext(" (default: %s)\n"), '@TEMPLATE_DIR@'); + print gettext(" --help, -h This help message\n"); + print gettext(" --version Version information\n"); print "\n"; exit($exitstatus); } +sub version { + my ($exitstatus) = @_; + printf(gettext("makepkg-template (pacman) %s\n"), '@PACKAGE_VERSION@'); + print gettext( + 'Copyright (c) 2013 Pacman Development Team <pacman-dev@archlinux.org>.'."\n". + 'This is free software; see the source for copying conditions.'."\n". + 'There is NO WARRANTY, to the extent permitted by law.'."\n"); + exit($exitstatus); +} + Getopt::Long::Configure ("bundling"); GetOptions( "help" => sub {usage(0); }, "h" => sub {usage(0); }, + "version" => sub {version(0); }, "input|p=s" => \$opts{input}, "output|o=s" => \$opts{output}, "newest|n" => \$opts{newest}, -- 1.8.2.3
On 05/29/13 at 09:49am, Florian Pritz wrote:
Signed-off-by: Florian Pritz <bluewind@xinu.at> --- scripts/makepkg-template.pl.in | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
diff --git a/scripts/makepkg-template.pl.in b/scripts/makepkg-template.pl.in index 7e37799..f3eda05 100755 --- a/scripts/makepkg-template.pl.in +++ b/scripts/makepkg-template.pl.in @@ -1,4 +1,22 @@ #!/usr/bin/perl +# makepkg-template - template system for makepkg +# @configure_input@ +# +# Copyright (c) 2013 Pacman Development Team <pacman-dev@archlinux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# use warnings; use strict; use v5.10.1; @@ -158,14 +176,27 @@ sub usage { print gettext(" (default: use version specified in the template markers)\n"); print gettext(" --template-dir <dir> directory to search for templates\n"); printf(gettext(" (default: %s)\n"), '@TEMPLATE_DIR@'); + print gettext(" --help, -h This help message\n"); + print gettext(" --version Version information\n"); print "\n"; exit($exitstatus); }
+sub version { + my ($exitstatus) = @_; + printf(gettext("makepkg-template (pacman) %s\n"), '@PACKAGE_VERSION@');
That line doesn't need to be translated.
+ print gettext( + 'Copyright (c) 2013 Pacman Development Team <pacman-dev@archlinux.org>.'."\n". + 'This is free software; see the source for copying conditions.'."\n". + 'There is NO WARRANTY, to the extent permitted by law.'."\n"); + exit($exitstatus); +} + Getopt::Long::Configure ("bundling"); GetOptions( "help" => sub {usage(0); }, "h" => sub {usage(0); },
Since we now treat --help and -h the same, we could go ahead and collapse those two while we're fiddling with this section: "help|h" => sub {usage(0); },
+ "version" => sub {version(0); }, "input|p=s" => \$opts{input}, "output|o=s" => \$opts{output}, "newest|n" => \$opts{newest}, -- 1.8.2.3
Signed-off-by: Florian Pritz <bluewind@xinu.at> --- v2: - no gettext for first line of version() - collapse -h and --help handling into one line scripts/makepkg-template.pl.in | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/scripts/makepkg-template.pl.in b/scripts/makepkg-template.pl.in index 7e37799..567514e 100755 --- a/scripts/makepkg-template.pl.in +++ b/scripts/makepkg-template.pl.in @@ -1,4 +1,22 @@ #!/usr/bin/perl +# makepkg-template - template system for makepkg +# @configure_input@ +# +# Copyright (c) 2013 Pacman Development Team <pacman-dev@archlinux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# use warnings; use strict; use v5.10.1; @@ -158,14 +176,26 @@ sub usage { print gettext(" (default: use version specified in the template markers)\n"); print gettext(" --template-dir <dir> directory to search for templates\n"); printf(gettext(" (default: %s)\n"), '@TEMPLATE_DIR@'); + print gettext(" --help, -h This help message\n"); + print gettext(" --version Version information\n"); print "\n"; exit($exitstatus); } +sub version { + my ($exitstatus) = @_; + printf "makepkg-template (pacman) %s\n", '@PACKAGE_VERSION@'; + print gettext( + 'Copyright (c) 2013 Pacman Development Team <pacman-dev@archlinux.org>.'."\n". + 'This is free software; see the source for copying conditions.'."\n". + 'There is NO WARRANTY, to the extent permitted by law.'."\n"); + exit($exitstatus); +} + Getopt::Long::Configure ("bundling"); GetOptions( - "help" => sub {usage(0); }, - "h" => sub {usage(0); }, + "help|h" => sub {usage(0); }, + "version" => sub {version(0); }, "input|p=s" => \$opts{input}, "output|o=s" => \$opts{output}, "newest|n" => \$opts{newest}, -- 1.8.2.3
On 05/29/13 at 02:51pm, Florian Pritz wrote:
Signed-off-by: Florian Pritz <bluewind@xinu.at> ---
v2: - no gettext for first line of version() - collapse -h and --help handling into one line
scripts/makepkg-template.pl.in | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-)
Ack.
participants (2)
-
Andrew Gregory
-
Florian Pritz