-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
We use the r1chardj0n3s/parse library to retrieve the placeholders out of the path. When I wrote this library I looked for functionality that does the inverse from f-strings and parse offered exactly this & has therefore been very helpful. It does the parsing by constructing regular expressions that are then matched against the path. However, there are 3 limitations:
- it offers format specifiers that are not invertible
- use format specifiers to create names #91
- Think about consequences of format specifiers in patterns #154
- Addendum to the
find_filesandfind_pathsdocumentation: use of regular expressions #155
- placeholders cannot be empty
- it's not typed
We could try to remove our dependency on parse and write out our own parsing functions/ regexes. We could also vendor and adapt it (it's under a MIT license). This could allow to overcome the issues above. We would need to think very much about which format specifiers are needed for paths.
Disadvantages:
- overall it works well the way it is now
- it would be quite some work
- a lot of thought went into the regexes - can we really do better (we might)
Alternatives:
- restrict the allowed format specifiers
- could allow custom types (but probably not a nice API)
- not a real problem
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels