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

--preserve-case enhancement: also use underscore-less CamelCase translations #9

Open
c-bb opened this issue Oct 20, 2015 · 1 comment

Comments

@c-bb
Copy link
Contributor

c-bb commented Oct 20, 2015

Currently, when --preserve-case is used to translate a CamelCase replacements to additional lowercase and uppercase replacements, it inserts underscores in between the word segments. This is cool, but on some occasions it would be useful to additionally do the replacement without the added underscores.

For example, the current behaviour is like this:

$ repren --full --from CamelCase --to DromedaryCase --preserve-case .
Using 4 patterns:
  'CAMEL_CASE' -> 'DROMEDARY_CASE'
  'CamelCase' -> 'DromedaryCase'
  'camelCase' -> 'dromedaryCase'
  'camel_case' -> 'dromedary_case'

It would be awesome if it could be extended to do this:

$ repren --full --from CamelCase --to DromedaryCase --preserve-case .
Using 6 patterns:
  'CAMEL_CASE' -> 'DROMEDARY_CASE'
  'CAMELCASE' -> 'DROMEDARYCASE'
  'CamelCase' -> 'DromedaryCase'
  'camelCase' -> 'dromedaryCase'
  'camel_case' -> 'dromedary_case'
  'camelcase' -> 'dromedarycase'

Perhaps this could be opt-in.

@jlevy
Copy link
Owner

jlevy commented Oct 21, 2015

Agree in principle. Just still thinking what the flags should be, so that there isn't a proliferation of random flags for every type of case convention. For example, the cleanest solution may be a pregen step that takes one pattern file and "case generalizes" it to another pattern file (and handles CAPS, dromedaryCamel, BactrianCamel, under_score, dash-style, and runtogether formats) that can be inspected/edited before use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants