fortran-lang / fprettify

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

Add an option to capitalize all keywords on format. #83

Closed ShrirajHegde closed 3 years ago

ShrirajHegde commented 3 years ago

(Feature Request)

An option to capitalize all keywords either on format or as soon as the keyword is detected, this might increase the readability of code by a huge fraction and remove the requirement to capitalize keywords during coding.

pseewald commented 3 years ago

This feature was implemented in #49 but the pr was never finalized due to no response from the author. The only thing open to discuss was the inclusion of non-standard HPF keywords. Probably I can just remove those and then merge the pr.

ShrirajHegde commented 3 years ago

Please do, it is pretty useful.

pseewald commented 3 years ago

This feature is now in (--case option). I leave this open for feedback.

ShrirajHegde commented 3 years ago

image Is this the correct usage?

It isn't working for me, also I can't find -case in fprettify -h

pseewald commented 3 years ago

It is documented in 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])

so if you want to uppercase all intrinsics, try --case 2 2 2 2. Suggestions for simpler defaults are welcome - I made it fully configurable since I don't know what conventions are in use.