Skip to content

Commit 811a249

Browse files
committed
Update cli 'lookup' command help message
1 parent 420635a commit 811a249

File tree

1 file changed

+8
-8
lines changed
  • cli-bot/src/main/kotlin/io/github/serpro69/kfaker/app/subcommands

1 file changed

+8
-8
lines changed

cli-bot/src/main/kotlin/io/github/serpro69/kfaker/app/subcommands/Lookup.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ import io.github.serpro69.kfaker.app.KFaker
55
import io.github.serpro69.kfaker.app.cli.Introspector
66
import io.github.serpro69.kfaker.app.cli.Renderer
77
import io.github.serpro69.kfaker.app.cli.renderProvider
8-
import io.github.serpro69.kfaker.app.subcommands.Lookup.functionName
8+
import io.github.serpro69.kfaker.app.subcommands.Lookup.name
99
import io.github.serpro69.kfaker.fakerConfig
1010
import picocli.CommandLine
1111
import kotlin.reflect.KFunction
1212
import kotlin.reflect.KProperty
1313

1414
/**
15-
* [KFaker] command for looking up required functionality by [functionName]
15+
* [KFaker] command for looking up required functionality by [name]
1616
*/
1717
@CommandLine.Command(
1818
name = "lookup",
19-
description = ["lookup functions by name"],
19+
description = ["lookup providers and functions by name"],
2020
mixinStandardHelpOptions = true
2121
)
2222
object Lookup : Runnable {
@@ -26,9 +26,9 @@ object Lookup : Runnable {
2626

2727
@CommandLine.Parameters(
2828
index = "0",
29-
description = ["function name to find in each provider", "case-insensitive"]
29+
description = ["name of the provider and/or provider function(s)", "partial name matching, case-insensitive"]
3030
)
31-
lateinit var functionName: String
31+
lateinit var name: String
3232

3333
private fun printMatchingFunctions() {
3434
val fakerConfig = fakerConfig {
@@ -42,10 +42,10 @@ object Lookup : Runnable {
4242
val filteredMap = introspector.providerData
4343
.mapValuesTo(mutableMapOf()) { (_, fpPair) ->
4444
val (functions, properties) = fpPair
45-
functions.filter { it.toString().lowercase().contains(functionName.lowercase()) } to
45+
functions.filter { it.toString().lowercase().contains(name.lowercase()) } to
4646
properties.filter { (sub, funcs) ->
47-
sub.toString().lowercase().contains(functionName.lowercase()) ||
48-
funcs.any { f -> f.toString().lowercase().contains(functionName.lowercase()) }
47+
sub.toString().lowercase().contains(name.lowercase()) ||
48+
funcs.any { f -> f.toString().lowercase().contains(name.lowercase()) }
4949
}
5050
}.filterValues { (funcs, subFuncs) ->
5151
funcs.count() > 0 || subFuncs.isNotEmpty()

0 commit comments

Comments
 (0)