Skip to content

gesundkrank/fzf4j

Repository files navigation

FZF4J

Release fzf4j

Fzf Java implementation to use in Java CLI applications. Based on https://github.com/junegunn/fzf.

Usage

FZF4J is intended to use in Java command-line applications. In case you want use it directly from the console just the original FZF.

Add the dependency to your build file

Maven
<dependency>
    <groupId>de.gesundkrank.fzf4j</groupId>
    <artifactId>fzf4j</artifactId>
    <version>VERSION</version>
</dependency>
Gradle
implementation group: 'de.gesundkrank.fzf4j', name: 'fzf4j', version: 'VERSION'

Example

Create FZF instance
Fzf fzf = Fzf.builder()
            .reverse()
            .orderBy(OrderBy.SCORE)
            .normalize()
            .build();
Select single item
String selectedItem = fzf.select(list);
Select multiple items
List<String> selectedItems = fzf.multiSelect(list);
Limit the number of selectable items
List<String> selectedItems = fzf.multiSelect(list, 5);