Skip to content

Commit

Permalink
Relax entries methods on select builder to take iterables (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajalt authored Jun 29, 2024
1 parent addb257 commit 44b88fa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions mordant/api/mordant.api
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ public final class com/github/ajalt/mordant/input/InteractiveSelectListBuilder {
public final fun descToggle (Ljava/lang/String;)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
public final fun entries ([Lcom/github/ajalt/mordant/widgets/SelectList$Entry;)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
public final fun entries ([Ljava/lang/String;)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
public final fun entriesEntry (Ljava/util/List;)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
public final fun entriesString (Ljava/util/List;)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
public final fun entriesEntry (Ljava/lang/Iterable;)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
public final fun entriesString (Ljava/lang/Iterable;)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
public final fun filterable (Z)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
public final fun keyExitFilter (Lcom/github/ajalt/mordant/input/KeyboardEvent;)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
public final fun keyFilter (Lcom/github/ajalt/mordant/input/KeyboardEvent;)Lcom/github/ajalt/mordant/input/InteractiveSelectListBuilder;
Expand All @@ -283,15 +283,15 @@ public final class com/github/ajalt/mordant/input/InteractiveSelectListBuilder {

public final class com/github/ajalt/mordant/input/InteractiveSelectListKt {
public static final fun interactiveMultiSelectList (Lcom/github/ajalt/mordant/terminal/Terminal;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
public static final fun interactiveMultiSelectListEntry (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/util/List;Ljava/lang/String;)Ljava/util/List;
public static synthetic fun interactiveMultiSelectListEntry$default (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/util/List;Ljava/lang/String;ILjava/lang/Object;)Ljava/util/List;
public static final fun interactiveMultiSelectListString (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/util/List;Ljava/lang/String;)Ljava/util/List;
public static synthetic fun interactiveMultiSelectListString$default (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/util/List;Ljava/lang/String;ILjava/lang/Object;)Ljava/util/List;
public static final fun interactiveMultiSelectListEntry (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/lang/Iterable;Ljava/lang/String;)Ljava/util/List;
public static synthetic fun interactiveMultiSelectListEntry$default (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/lang/Iterable;Ljava/lang/String;ILjava/lang/Object;)Ljava/util/List;
public static final fun interactiveMultiSelectListString (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/lang/Iterable;Ljava/lang/String;)Ljava/util/List;
public static synthetic fun interactiveMultiSelectListString$default (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/lang/Iterable;Ljava/lang/String;ILjava/lang/Object;)Ljava/util/List;
public static final fun interactiveSelectList (Lcom/github/ajalt/mordant/terminal/Terminal;Lkotlin/jvm/functions/Function1;)Ljava/lang/String;
public static final fun interactiveSelectListEntry (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/util/List;Ljava/lang/String;)Ljava/lang/String;
public static synthetic fun interactiveSelectListEntry$default (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/util/List;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
public static final fun interactiveSelectListString (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/util/List;Ljava/lang/String;)Ljava/lang/String;
public static synthetic fun interactiveSelectListString$default (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/util/List;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
public static final fun interactiveSelectListEntry (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/lang/Iterable;Ljava/lang/String;)Ljava/lang/String;
public static synthetic fun interactiveSelectListEntry$default (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/lang/Iterable;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
public static final fun interactiveSelectListString (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/lang/Iterable;Ljava/lang/String;)Ljava/lang/String;
public static synthetic fun interactiveSelectListString$default (Lcom/github/ajalt/mordant/terminal/Terminal;Ljava/lang/Iterable;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
}

public final class com/github/ajalt/mordant/input/KeyboardEvent : com/github/ajalt/mordant/input/InputEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class InteractiveSelectListBuilder(private val terminal: Terminal) {

/** Set the list of items to select from */
@JvmName("entriesEntry")
fun entries(entries: List<SelectList.Entry>): InteractiveSelectListBuilder = apply {
fun entries(entries: Iterable<SelectList.Entry>): InteractiveSelectListBuilder = apply {
config.entries = entries.toMutableList()
}

Expand All @@ -72,7 +72,7 @@ class InteractiveSelectListBuilder(private val terminal: Terminal) {

/** Set the list of items to select from */
@JvmName("entriesString")
fun entries(entries: List<String>): InteractiveSelectListBuilder = apply {
fun entries(entries: Iterable<String>): InteractiveSelectListBuilder = apply {
config.entries = entries.mapTo(mutableListOf()) { SelectList.Entry(it) }
}

Expand Down Expand Up @@ -288,8 +288,8 @@ class InteractiveSelectListBuilder(private val terminal: Terminal) {
}
}

private open class SelectInputAnimation(
final override val terminal: Terminal,
private class SelectInputAnimation(
override val terminal: Terminal,
private val config: SelectConfig,
private val singleSelect: Boolean,
) : InputReceiverAnimation<List<String>?> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ inline fun Terminal.interactiveSelectList(
*/
@JvmName("interactiveSelectListString")
fun Terminal.interactiveSelectList(
entries: List<String>,
entries: Iterable<String>,
title: String = "",
): String? {
return interactiveSelectList {
Expand All @@ -45,7 +45,7 @@ fun Terminal.interactiveSelectList(
*/
@JvmName("interactiveSelectListEntry")
fun Terminal.interactiveSelectList(
entries: List<SelectList.Entry>,
entries: Iterable<SelectList.Entry>,
title: String = "",
): String? {
return interactiveSelectList {
Expand Down Expand Up @@ -77,7 +77,7 @@ inline fun Terminal.interactiveMultiSelectList(
*/
@JvmName("interactiveMultiSelectListEntry")
fun Terminal.interactiveMultiSelectList(
entries: List<SelectList.Entry>,
entries: Iterable<SelectList.Entry>,
title: String = "",
): List<String>? {
return interactiveMultiSelectList {
Expand All @@ -95,7 +95,7 @@ fun Terminal.interactiveMultiSelectList(
*/
@JvmName("interactiveMultiSelectListString")
fun Terminal.interactiveMultiSelectList(
entries: List<String>,
entries: Iterable<String>,
title: String = "",
): List<String>? {
return interactiveMultiSelectList {
Expand Down

0 comments on commit 44b88fa

Please sign in to comment.