Adjust help output, accept -?, capitalize. Patch by Christian Dywan

* glib-mkenums.in: Adjust help output, accept -?, capitalize.
        Patch by Christian Dywan


svn path=/trunk/; revision=7930
This commit is contained in:
Matthias Clasen 2009-03-01 15:40:07 +00:00
parent 87a7377338
commit 789e260638
2 changed files with 44 additions and 34 deletions

View File

@ -1,3 +1,10 @@
2009-03-01 Matthias Clasen <mclasen@redhat.com>
Bug 556706 Inconsistent help arguments -h, -?
* glib-mkenums.in: Adjust help output, accept -?, capitalize.
Patch by Christian Dywan
2009-02-17 Matthias Clasen <mclasen@redhat.com> 2009-02-17 Matthias Clasen <mclasen@redhat.com>
* === Released 2.19.8 === * === Released 2.19.8 ===

View File

@ -133,30 +133,33 @@ sub version {
exit 0; exit 0;
} }
sub usage { sub usage {
print "Usage: glib-mkenums [options] [files...]\n"; print "Usage:\n";
print " --fhead <text> output file header\n"; print " glib-mkenums [OPTION...] [FILES...]\n\n";
print " --fprod <text> per input file production\n"; print "Help Options:\n";
print " --ftail <text> output file trailer\n"; print " -h, --help Show this help message\n\n";
print " --eprod <text> per enum text (produced prior to value itarations)\n"; print "Utility Options:\n";
print " --vhead <text> value header, produced before iterating over enum values\n"; print " --fhead <text> Output file header\n";
print " --vprod <text> value text, produced for each enum value\n"; print " --fprod <text> Per input file production\n";
print " --vtail <text> value tail, produced after iterating over enum values\n"; print " --ftail <text> Output file trailer\n";
print " --comments <text> comment structure\n"; print " --eprod <text> Per enum text (produced prior to value itarations)\n";
print " --template file template file\n"; print " --vhead <text> Value header, produced before iterating over enum values\n";
print " -h, --help show this help message\n"; print " --vprod <text> Value text, produced for each enum value\n";
print " -v, --version print version informations\n"; print " --vtail <text> Value tail, produced after iterating over enum values\n";
print " --comments <text> Comment structure\n";
print " --template file Template file\n";
print " -v, --version Print version informations\n\n";
print "Production text substitutions:\n"; print "Production text substitutions:\n";
print " \@EnumName\@ PrefixTheXEnum\n"; print " \@EnumName\@ PrefixTheXEnum\n";
print " \@enum_name\@ prefix_the_xenum\n"; print " \@enum_name\@ prefix_the_xenum\n";
print " \@ENUMNAME\@ PREFIX_THE_XENUM\n"; print " \@ENUMNAME\@ PREFIX_THE_XENUM\n";
print " \@ENUMSHORT\@ THE_XENUM\n"; print " \@ENUMSHORT\@ THE_XENUM\n";
print " \@ENUMPREFIX\@ PREFIX\n"; print " \@ENUMPREFIX\@ PREFIX\n";
print " \@VALUENAME\@ PREFIX_THE_XVALUE\n"; print " \@VALUENAME\@ PREFIX_THE_XVALUE\n";
print " \@valuenick\@ the-xvalue\n"; print " \@valuenick\@ the-xvalue\n";
print " \@type\@ either enum or flags\n"; print " \@type\@ either enum or flags\n";
print " \@Type\@ either Enum or Flags\n"; print " \@Type\@ either Enum or Flags\n";
print " \@TYPE\@ either ENUM or FLAGS\n"; print " \@TYPE\@ either ENUM or FLAGS\n";
print " \@filename\@ name of current input file\n"; print " \@filename\@ name of current input file\n";
exit 0; exit 0;
} }
@ -220,17 +223,17 @@ if (!defined $ARGV[0]) {
while ($_=$ARGV[0],/^-/) { while ($_=$ARGV[0],/^-/) {
shift; shift;
last if /^--$/; last if /^--$/;
if (/^--template$/) { read_template_file (shift); } if (/^--template$/) { read_template_file (shift); }
elsif (/^--fhead$/) { $fhead = $fhead . shift } elsif (/^--fhead$/) { $fhead = $fhead . shift }
elsif (/^--fprod$/) { $fprod = $fprod . shift } elsif (/^--fprod$/) { $fprod = $fprod . shift }
elsif (/^--ftail$/) { $ftail = $ftail . shift } elsif (/^--ftail$/) { $ftail = $ftail . shift }
elsif (/^--eprod$/) { $eprod = $eprod . shift } elsif (/^--eprod$/) { $eprod = $eprod . shift }
elsif (/^--vhead$/) { $vhead = $vhead . shift } elsif (/^--vhead$/) { $vhead = $vhead . shift }
elsif (/^--vprod$/) { $vprod = $vprod . shift } elsif (/^--vprod$/) { $vprod = $vprod . shift }
elsif (/^--vtail$/) { $vtail = $vtail . shift } elsif (/^--vtail$/) { $vtail = $vtail . shift }
elsif (/^--comments$/) { $comment_tmpl = shift } elsif (/^--comments$/) { $comment_tmpl = shift }
elsif (/^--help$/ || /^-h$/) { usage; } elsif (/^--help$/ || /^-h$/ || /^-h$/) { usage; }
elsif (/^--version$/ || /^-v$/) { version; } elsif (/^--version$/ || /^-v$/) { version; }
else { usage; } else { usage; }
last if not defined($ARGV[0]); last if not defined($ARGV[0]);
} }