Kotlin / Kotlin/kotlinx-cli

Transform the value of an argument

Open
#28 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
951
Forks
71
PR merge metrics
No merged PRs in 30d

Description

Hello,
Is there a way to transform the value of an argument like:

```kotlin
val parser = ArgParser(args)
val file: File by parser.option(ArgType.String, transform = { File(it) })
```
instead of
```kotlin
val parser = ArgParser(args)
val filename: String by parser.option(ArgType.String)
val file: File = File(filename)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the ArgParser.option API, including ArgType.String and its existing argument conversion behavior. Done means the shown transform lambda can produce a File value directly from the option and the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.