Skip to content

πŸ“¦ v0.1.3 β€” Polished CLI APIs & Fancy Output!

Choose a tag to compare

@kys0ff kys0ff released this 10 May 09:42
· 19 commits to master since this release

πŸš€ New Features

  • Text Styling Enhancements

    • Added .bold(), .italic(), .underline(), .faint(), .slowBlink(), .rapidBlink(), .reversed(), .conceal(), and .crossedOut() extensions to style your console text easily.
  • Improved action {} API

    • Cleaner, scoped action { ... } with param { get(...) } and getFlag(...) methods for fetching arguments and flags.
    • Removes the need to manually handle args objects.
  • Global Crash Handler

    • New onCrash block inside kli {} scope for handling uncaught errors in a friendly way.
  • Better Interactive Input

    • readInputOrNull() now integrates naturally in commands with colored prompts.

πŸ—‘οΈ Deprecations

  • action { args -> } β†’ Deprecated.
    βœ… Migrate to the new scoped action { ... } style for better DX.

  • Args typealias β†’ Deprecated.
    βœ… Please use ArgsScope for clearer meaning and future-proofing.


🎨 New Text Styles Available

  • .faint() β€” Make the text light.
  • .italic() β€” Italicize the text.
  • .underline() β€” Underline text.
  • .slowBlink() β€” Slow blinking text (where supported).
  • .rapidBlink() β€” Fast blinking text (where supported).
  • .reversed() β€” Reverse foreground and background colors.
  • .conceal() β€” Hide the text.
  • .crossedOut() β€” Strike-through the text.

πŸ†š Migration Example

πŸ”΄ Before (v0.1.1):

action { args ->
    val name = args.getParams().getOrNull(1)
        ?: readInputOrNull("Enter your name", AnsiColor.CYAN) ?: "stranger"

    val greeting = "Hello, $name"
    if (args.getFlag("shout"))
        println(greeting.uppercase())
    else println(greeting)
}

🟒 Now (v0.1.3):

action {
    val name = param { get("name") ?: readInputOrNull("Enter your name", AnsiColor.CYAN) ?: "stranger" }
    val greeting = "Hello, $name".italic().bold().underline()
    if (getFlag("shout"))
        print(greeting.uppercase(), AnsiColor.rgbHex(0xFF8BF5))
    else print(greeting, AnsiColor.rgbHex(0xFF8BF5))

    println()
}

πŸ”₯ Migration Tips

  • πŸ”„ Replace action { args -> } with action { ... }.
  • ➑️ Switch from Args alias β†’ ArgsScope.
  • 🎨 Use .bold(), .italic(), .underline() and print(..., AnsiColor) for colorful, styled output.

Full Changelog: v0.1.1...v0.1.3