/peco.py

A python package of filtering tool like peco

Primary LanguagePythonBSD 2-Clause "Simplified" LicenseBSD-2-Clause

peco.py (WIP)

demo.gif

This is a python prompt tool that enables users to select a choice(line) by filtering interactively like peco. This package is not a CLI tool.

You can easily use this by passing list of choices in your python code like following:

from peco import Peco

def alphabets():
    return [chr(ord("A") + i) for i in range(26)]

dummy_choices = alphabets()
selected_choice = Peco(dummy_choices).run()

print("selected:", selected_choice)
# >> selected: D

TODO:

  • highlight line correctly
  • paging
  • separate label and value from choices argument