fortran-lang / fprettify

auto-formatter for modern fortran source code
https://pypi.python.org/pypi/fprettify
Other
370 stars 76 forks source link

CASE option fails in config file #94

Closed bclmary closed 3 years ago

bclmary commented 3 years ago

Hy,

When --case option is used in a config file (using -c option), an error message is returned : <path>/fprettify: error: argument --case: expected 4 arguments

If --case is used from the command line (with same arguments), everything works fine.

Other tested options work well in command line and config file.

Used version : 0.3.7 from pip

Otherwise fprettify is a great tool !

pseewald commented 3 years ago

I get the same error message from the command line. This is expected because --case does need 4 arguments.

fprettify -h

  --case CASE CASE CASE CASE
                        Enable letter case formatting of intrinsics by
                        specifying which of keywords, procedures/modules,
                        operators and constants (in this order) should be
                        lowercased or uppercased - 0: do nothing | 1:
                        lowercase | 2: uppercase (default: [0, 0, 0, 0])

This is a bit cryptic at the moment because it's intended to be fully customizable. For instant, if you want to uppercase all intrinsics, use --case 2 2 2 2.

bclmary commented 3 years ago

I misspoke my problem. Giving the 4 arguments with --case in the command line works well for me. Bu if I put --case with the same 4 arguments (or any others) in the config file, then I get the error message. It seems that the arguments are not well parsed in the config file.

By the way, the help message for --case is clear enough. I appreciate the way to explain this kind of option in such few words.

pseewald commented 3 years ago

Ah I understand, thanks a lot for reporting.

danielhollas commented 3 years ago

In case anybody runs into this, the original error message was likely caused by a wrong format in the config file. The correct format for multiple arguments is this:

case=[1,1,1,2]

See: https://pypi.org/project/ConfigArgParse/#special-values

The same format also work for the --exclude option.