-
Notifications
You must be signed in to change notification settings - Fork 128
Description
= is a valid char in a posix cli argument or filesystem paths, but clikt currently doesn't accept it and errors with "no such option".
I come from far away with this issue 🙂. My real-world situation is developing a React Native app, using pnpm's patching feature, which creates folders with =, which google prefab, called by Android Gradle Plugin without a -- before arguments, fails to handle. Prefab uses clikt.
class C : CliktCommand() {
val x by argument()
override fun run() = echo(x)
}
C().parse("/some/path-with=sign/foo")→ Error: no such option /some/path-with
I've looked at the code a little and I know it's complicated as / can be a valid prefix for options. I'm probably missing some things, but it looks like ignoring unknown prefixes when trying to detect options could fix the issue without too many bad side-effects. Something like this:
private fun isLongOptionWithEquals(prefix: String, token: String): Boolean {
// ...
+ if (prefix !in prefixes) return false
return context.transformToken(context, token.take(2)) !in optionsByName
}Happy to make a PR if it helps!