ajalt / mordant

Multiplatform text styling for Kotlin command-line applications
https://ajalt.github.io/mordant/
Apache License 2.0
957 stars 34 forks source link

Add support for iOS, watchOS and tvOS #120

Closed conradev closed 4 months ago

conradev commented 12 months ago

This adds support for all known Apple platforms

I was upgrading my iOS/macOS/Android app to Kotlin 1.9.10 in the process of replacing my usage of kotlinx-cli with clikt, I realized that it doesn't have support for iOS. I added support to clikt, and it depends on mordant and thus here I am 😄

This approach works well for kotlin-logging, which I use for logging in my app.

I use command line arguments on iOS to configure the binary for integration testing:

Screenshot 2023-09-09 at 7 35 27 PM
ajalt commented 12 months ago

Thanks for the PR, and thanks for the use case example; I would have wondered how a CLI could be used on an iphone.

Let add these targets to the github actions tests for the macos runner (or at least all of the targets that can be run from ios).

Do ios, watchos, and tvos have identical syscalls to macos? Otherwise we'll need to write new versions of MppImpl.kt for those targets.

hick209 commented 5 months ago

In case it's easy, while you are at it, would you mind setting things up for Android as well?

Use case

In my company here there are people that are running clikt inside their test flavor of Android app, which they use to validate things in some e2e tests they run.

Because of this, we're currently stuck on clikt pre 4.0 and I'd love to bump to the latest. Once I get some time I plan on trying to get the code for it into Mordant (and maybe clikt if necessary).

hick209 commented 5 months ago

I've created an issue about this #165 with more details

ajalt commented 4 months ago

I added iOS in #168, watchOS and tvOS are blocked by https://github.com/JetBrains/markdown/pull/159