Skip to content

Commit

Permalink
[patch] adding quiet option for welcome in tagger cli, for calculate-…
Browse files Browse the repository at this point in the history
…version usability
  • Loading branch information
robertfmurdock committed Aug 28, 2024
1 parent 275d785 commit b739b10
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package com.zegreatrob.tools.tagger.cli

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.flag
import com.github.ajalt.clikt.parameters.options.option

class Welcome : CliktCommand() {

private val quiet by option("--quiet", "-q")
.flag(default = false)

override fun run() {
echo("Welcome to Tagger CLI.")
if (!quiet) {
echo("Welcome to Tagger CLI.")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.zegreatrob.tools.tagger.cli

import com.github.ajalt.clikt.testing.test
import kotlin.test.Test
import kotlin.test.assertEquals

class WelcomeTest {
@Test
fun quietWillSuppressWelcome() {
Welcome()
.test("--quiet")
.output
.let {
assertEquals("", it)
}
}

@Test
fun quietHasShorthand() {
Welcome()
.test("-q")
.output
.let {
assertEquals("", it)
}
}
}

0 comments on commit b739b10

Please sign in to comment.