Skip to content

Commit ab95ea9

Browse files
committed
Add Markdown formatting for changelog
1 parent 8481ea1 commit ab95ea9

File tree

7 files changed

+16
-35
lines changed

7 files changed

+16
-35
lines changed

gradle/cli.versions.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
[versions]
22
cli-version = "0.18.0"
33

4+
clikt = "5.0.3"
5+
46
[libraries]
5-
clikt = "com.github.ajalt.clikt:clikt:5.0.3"
7+
clikt = { module = "com.github.ajalt.clikt:clikt", version.ref = "clikt" }
8+
clikt-markdown = { module = "com.github.ajalt.clikt:clikt-markdown", version.ref = "clikt" }
69
mockk = "io.mockk:mockk:1.14.6"
710
r8 = "com.android.tools:r8:8.11.18"

tools/cli/CHANGELOG.md

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,39 @@
22

33
## [Unreleased]
44

5-
### Changed
6-
75
- Separate CLI versioning from plugin versioning
8-
9-
### Added
10-
116
- Add `changelog` command to print CLI changelog
127

138
## [0.17.3] - 2025-10-14
149

15-
### Fixed
16-
1710
- Fixed executable permissions for the 'valkyrie' binary in CLI distribution
1811

1912
## [0.16.0] - 2025-07-24
2013

21-
### Changed
22-
2314
- Use fully qualified imports if icon name conflicts with Compose qualifiers
2415

2516
## [0.15.0] - 2025-06-28
2617

27-
### Added
28-
29-
- Added `--auto-mirror` option to force add "autoMirror=true" or "autoMirror=false" option to generated ImageVector
18+
- Added `--auto-mirror` option to forcibly add "autoMirror=true" or "autoMirror=false" option to generated ImageVector
3019

3120
## [0.14.0] - 2025-04-28
3221

33-
### Changed
34-
3522
- Migrate to hierarchical icon pack structure. CLI options `--iconpack-name` and `--nested-packs` removed in favour of
3623
`--iconpack`
3724

38-
Single pack:
39-
❌ ./valkyrie --iconpack-name=ValkyrieIcons
40-
✅ ./valkyrie --iconpack=ValkyrieIcons
41-
42-
Nested packs:
43-
❌ ./valkyrie --iconpack-name=ValkyrieIcons --nested-packs=Colored,Filled
44-
✅ ./valkyrie --iconpack=ValkyrieIcons.Colored,ValkyrieIcons.Filled
45-
46-
### Added
25+
| Old syntax example | New syntax example |
26+
|--------------------------------------------------------------------------|--------------------------------------------------------------------|
27+
| `./valkyrie --iconpack-name=ValkyrieIcons` | `./valkyrie --iconpack=ValkyrieIcons` |
28+
| `./valkyrie --iconpack-name=ValkyrieIcons --nested-packs=Colored,Filled` | `./valkyrie --iconpack=ValkyrieIcons.Colored,ValkyrieIcons.Filled` |
4729

4830
- Added `--use-compose-colors` option to use predefined Compose colors instead of hex color codes (e.g. Color.Black
4931
instead of Color(0xFF000000))
5032

5133
## [0.13.0] - 2025-03-08
5234

53-
### Added
54-
5535
- Added `--preview-annotation-type` option to specify the type of Preview annotation (must be either 'androidx' or '
5636
jetbrains')
5737

5838
## [0.11.0] - 2024-11-25
5939

60-
### Added
61-
6240
- Initial release of Valkyrie CLI tool

tools/cli/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ dependencies {
100100
implementation(projects.sdk.ir.core)
101101

102102
implementation(cli.clikt)
103+
implementation(cli.clikt.markdown)
103104
r8(cli.r8)
104105

105106
testImplementation(projects.components.test.resourceLoader)

tools/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/ChangelogCommand.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ package io.github.composegears.valkyrie.cli.command
22

33
import com.github.ajalt.clikt.core.CliktCommand
44
import com.github.ajalt.clikt.core.Context
5+
import com.github.ajalt.mordant.markdown.Markdown
56

67
internal class ChangelogCommand : CliktCommand(name = "changelog") {
78

89
override fun run() {
9-
echo(loadResourceText("CHANGELOG.md"))
10+
echo(Markdown(loadResourceText("CHANGELOG.md"), showHtml = true))
1011
}
1112

1213
override fun help(context: Context): String = "Print CLI changelog"
1314
}
1415

15-
fun Any.loadResourceText(name: String): String {
16+
private fun Any.loadResourceText(name: String): String {
1617
val classLoader = this::class.java.classLoader
1718
val inputStream = classLoader.getResourceAsStream(name) ?: error("Resource '$name' not found")
1819
return inputStream.bufferedReader().use { it.readText() }

tools/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/IconPackCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ internal class IconPackCommand : CliktCommand(name = "iconpack") {
6363

6464
override val printHelpOnEmptyArgs: Boolean = true
6565

66-
override fun help(context: Context): String = "A CLI tool to generate an IconPack object."
66+
override fun help(context: Context): String = "A CLI tool to generate an IconPack object"
6767

6868
override fun run() {
6969
generateIconPack(

tools/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/SvgXmlToImageVectorCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ internal class SvgXmlToImageVectorCommand : CliktCommand(name = "svgxml2imagevec
126126

127127
override val printHelpOnEmptyArgs: Boolean = true
128128

129-
override fun help(context: Context): String = "A CLI tool to convert SVG/XML into Compose ImageVector."
129+
override fun help(context: Context): String = "A CLI tool to convert SVG/XML into Compose ImageVector"
130130

131131
override fun run() {
132132
svgXml2ImageVector(

tools/cli/src/test/kotlin/io/github/composegears/valkyrie/cli/command/ChangelogCommandTest.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package io.github.composegears.valkyrie.cli.command
22

33
import assertk.assertThat
44
import assertk.assertions.contains
5-
import assertk.assertions.isEqualTo
65
import assertk.assertions.isNotEmpty
76
import com.github.ajalt.clikt.testing.test
87
import kotlin.test.Test
@@ -13,8 +12,7 @@ class ChangelogCommandTest {
1312
fun `run should print CHANGELOG content`() {
1413
val result = ChangelogCommand().test()
1514

16-
val expectedChangelog = loadResourceText("CHANGELOG.md")
17-
assertThat(result.output.trim()).isEqualTo(expectedChangelog.trim())
15+
assertThat(result.output).contains("CLI Changelog")
1816
}
1917

2018
@Test

0 commit comments

Comments
 (0)