Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASE option fails in config file #94

Closed
bclmary opened this issue Dec 15, 2020 · 4 comments
Closed

CASE option fails in config file #94

bclmary opened this issue Dec 15, 2020 · 4 comments
Labels
bug non-critical bug (or with workaround)

Comments

@bclmary
Copy link

bclmary commented Dec 15, 2020

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
Copy link
Collaborator

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
Copy link
Author

bclmary commented Dec 15, 2020

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
Copy link
Collaborator

Ah I understand, thanks a lot for reporting.

@pseewald pseewald added the bug non-critical bug (or with workaround) label Dec 15, 2020
@danielhollas
Copy link

danielhollas commented May 26, 2021

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.

danielhollas added a commit to danielhollas/fprettify that referenced this issue May 27, 2021
I also added a bunch of tests to test this functionality.
The new tests also cover the fix for fortran-lang#94.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug non-critical bug (or with workaround)
Projects
None yet
Development

No branches or pull requests

3 participants