]> git.donarmstrong.com Git - perltidy.git/blobdiff - examples/perltidyrc_dump.pl
all debian patches are now upstream
[perltidy.git] / examples / perltidyrc_dump.pl
old mode 100644 (file)
new mode 100755 (executable)
index 4ec2115..f2008e7
@@ -190,8 +190,17 @@ sub dump_options {
             # print the long version of the parameter
             # with the short version as a side comment
             my $short_name   = $short_name{$long_name};
-            my $short_option = $short_prefix . $short_name . $suffix;
             my $long_option  = $prefix . $long_name . $suffix;
+
+           # A few options do not have a short abbreviation.  These include
+           # 'recombine' and 'valign', which are mainly for debugging.  As a
+           # workaround, we will make it the same as the long option. This
+           # will insure that the -s -q flags work.  
+           my $short_option = $long_option;
+           if ($short_name) {
+               $short_option = $short_prefix . $short_name . $suffix;
+           }
+
             my $note = $requals_default->{$long_name} ? "  [=default]" : "";
             if ( $rmy_opts->{s} ) {
                 print $short_option. "\n";
@@ -262,7 +271,7 @@ sub read_perltidyrc {
     my $empty_file = "";    # this will be our .perltidyrc file
     my %Opts_default;       # this will receive the default options hash
     my %abbreviations_default;
-    Perl::Tidy::perltidy(
+    my $err = Perl::Tidy::perltidy(
         perltidyrc         => \$empty_file,
         dump_options       => \%Opts_default,
         dump_options_type  => 'full',                  # 'full' gives everything
@@ -270,6 +279,9 @@ sub read_perltidyrc {
         stderr             => \$stderr,
         argv               => \$argv,
     );
+    if ($err) {
+        die "Error calling perltidy\n";
+    }
 
     # now we call with a .perltidyrc file to get its parameters
     my %Getopt_flags;