matejak / argbash

Bash argument parsing code generator
Other
1.39k stars 63 forks source link

Inconsistent indentation with validators #143

Open matejak opened 3 years ago

matejak commented 3 years ago

When validation functions such as 'pint()' are placed into the resulting shell script they do not include the same indentation specified using ARGBASH_SET_INDENT([ ]) instead the hard tabs remain and the rest of the script has the four spaces.

I can see that the problem is the lack of _INDENT_() or _JOIN_INDENTED() macros within value_validators.m4 file. I tried to get indentation to occur within the following macro so that all validators are covered, including those created as a result of using ARG_TYPE_GROUP_SET():

dnl
dnl Put definitions of validating functions if they are needed
m4_define([_PUT_VALIDATORS], [m4_do(
        [m4_set_empty([VALUE_TYPES_USED], , [m4_n([# validators])])],
        [m4_set_foreach([VALUE_TYPES], [_val_type], [m4_do(
                [m4_set_empty(m4_expand([[VALUE_GROUP_]_val_type]), ,
                        m4_expand([_ENDL_()[_validator_]_val_type[]_ENDL_(2)]))],
        )])],
)])

I had hoped that I could send you a simple diff-patch with an elegant fix, unfortunately I have no M4 scripting knowledge and despite spending time looking at other parts of the code as a guide and after numerous attempts I still could not get the results that I wanted using m4.