]> git.donarmstrong.com Git - perltidy.git/commitdiff
allow -vil=s without -vxl='*'
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 7 Feb 2022 19:23:12 +0000 (11:23 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 7 Feb 2022 19:23:12 +0000 (11:23 -0800)
bin/perltidy
lib/Perl/Tidy/VerticalAligner.pm

index bc5932390d93da886b728bf12236c3a95d265e73..0733f6ae6cd01ef7220bdf6b7fb2f66e25c763c9 100755 (executable)
@@ -4345,20 +4345,23 @@ of the tokens ',', '=', and '=>', but many other alignments are possible and are
   { ( ? : , ; => && || ~~ !~~ =~ !~ // <=> ->
   if unless and or err for foreach while until
 
-These alignments are all enabled by default, but they can be selectively disabled by including one or more of these tokens in the space-separated list B<valign-exclusion-list=s>.  For example, the following would prevent alignment at B<=> and B<if>:
+These alignments are all enabled by default, but they can be selectively disabled by including one or more of these tokens in the space-separated list B<valign-exclusion-list=s>.
+For example, the following would prevent alignment at B<=> and B<if>:
 
   --valign-exclusion-list='= if'
 
-If it is simpler to specify only the token types which are to be aligned, then use the special symbol B<*> for this exclusion list and include the types which are to be aligned in the list of B<--valign-inclusion-list> (this works because B<*> is not one of the alignment tokens). For example,
-the following parameters enable alignment only at commas and 'fat commas':
+If it is simpler to specify only the token types which are to be aligned, then
+include the types which are to be aligned in the list of B<--valign-inclusion-list>.
+You may leave the B<valign-exclusion-list> undefined, or use the special symbol B<*> for the exclusion list.
+For example, the following parameters enable alignment only at commas and 'fat commas':
 
-  --valign-exclusion-list='*'
   --valign-inclusion-list=', =>'
+  --valign-exclusion-list='*'     ( this is optional and may be omitted )
 
 These parameter lists should consist of space-separated tokens from the above
-list of possible alignment tokens.  If an unrecognized parameter appears, it is
-simply ignored. And if a parameter is entered in both lists by mistake
-then the exclusion list has priority.
+list of possible alignment tokens, or a '*'.  If an unrecognized token
+appears, it is simply ignored. And if a specific token is entered in both lists by
+mistake then the exclusion list has priority.
 
 The default values of these parameters enable all alignments and are equivalent to
 
@@ -4372,9 +4375,9 @@ To illustrate, consider the following snippet with default formatting
     $co_prompt      = ($color) ? 'bold green' : '';           # prompt
     $co_unused      = ($color) ? 'on_green'   : 'reverse';    # unused
 
-To exclude all alignments except the equals we could use:
+To exclude all alignments except the equals (i.e., include only equals) we could use:
 
-    # perltidy -vxl='*' -vil='='
+    # perltidy -vil='='
     $co_description = ($color) ? 'bold cyan' : '';          # description
     $co_prompt      = ($color) ? 'bold green' : '';         # prompt
     $co_unused      = ($color) ? 'on_green' : 'reverse';    # unused
index f4cad45fe45241305d6ca143e2475b3e5a358f26..d222fdf4511c0a98674acaa80e937769d5a607eb 100644 (file)
@@ -192,6 +192,13 @@ sub check_options {
     %valign_control_hash    = ();
     $valign_control_default = 1;
 
+    # If -vil=s is entered without -vxl, assume -vxl='*'
+    if (  !$rOpts->{'valign-exclusion-list'}
+        && $rOpts->{'valign-inclusion-list'} )
+    {
+        $rOpts->{'valign-exclusion-list'} = '*';
+    }
+
     # See if the user wants to exclude any alignment types ...
     if ( $rOpts->{'valign-exclusion-list'} ) {