Commit Graph

16 Commits

Author SHA1 Message Date
Sebastian Lohff 9fe596bc01 Add option to return instantly on single item in cli_select_item()
cli_select_item() allows to quickly launch a menu from code, but if only
a single item is given a selection is not necessary in most cases.
Therefore we now instantly return the given value in these cases. This
can be turned off by setting return_single=False
2020-03-11 17:55:16 +01:00
Sebastian Lohff d926606976 Add shortcut function to quickly get a selection result
cli_select_item() will instanciate a CliMenu and return a selection. If
the selection is aborted an exception of the given class will be thrown.
2020-01-23 09:59:55 +01:00
Sebastian Lohff 3d1d2d5acd Add theme example 2019-08-15 15:13:18 +02:00
Sebastian Lohff 58d6170a5c Add bold highlight style to defaults 2019-08-15 15:10:21 +02:00
Sebastian Lohff 206dcc46df Correct typo in var name 2019-08-15 15:10:07 +02:00
Sebastian Lohff 58455be58a Add methods to get all available menu options 2019-07-18 13:32:23 +02:00
Sebastian Lohff f0e5b7bb58 Implement searching for menu items
This uses prompt-toolkit's builtin search functionality to search
through the buffer representing the menu, allowing the user
to navigate faster through the entries
2019-04-22 14:35:38 +02:00
Sebastian Lohff ec07ebe536 Sort imports 2019-02-25 01:02:38 +01:00
Sebastian Lohff 6a128e13a6 Header indentation and tuple options for constructor 2019-02-13 10:18:26 +01:00
Sebastian Lohff 2f2049bfef Add k/j as up/down keys 2019-02-04 11:36:07 +01:00
Sebastian Lohff 0517b4d996 Return no selection if the user aborted selection
Also expose success state
2019-02-01 18:58:09 +01:00
Sebastian Lohff ad3fd751cc Move cursor along with selection for scrolling 2019-02-01 18:46:09 +01:00
Sebastian Lohff e0177d0e10 Fix inline header indentation 2019-02-01 18:17:57 +01:00
Sebastian Lohff b18372e3b8 Allow passing an item to each option 2019-02-01 18:17:57 +01:00
Sebastian Lohff 6655fd097a Add two simple examples 2019-02-01 00:03:42 +01:00
Sebastian Lohff bd31b70e44 Initial commit 2019-01-31 23:58:29 +01:00