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

Add configurable automatic name mapping from camelCase to kebab-case #101

Merged
merged 9 commits into from
Jan 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
.
  • Loading branch information
lihaoyi committed Jan 24, 2024
commit eeb35f56f6565db23b74360100236be55b35026d
6 changes: 3 additions & 3 deletions mainargs/src/Util.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ object Util {
def nullNameMapper(s: String): Option[String] = None

def kebabCaseNameMapper(s: String): Option[String] = {
baseNameMapper(s, "-")
baseNameMapper(s, '-')
}
def snakeCaseNameMapper(s: String): Option[String] = {
baseNameMapper(s, "_")
baseNameMapper(s, '_')
}

def baseNameMapper(s: String, sep: String): Option[String] = {
def baseNameMapper(s: String, sep: Char): Option[String] = {
val chars = new collection.mutable.StringBuilder
// 'D' -> digit
// 'U' -> uppercase
Expand Down