Commit Graph

27 Commits

Author SHA1 Message Date
Sebastian Lohff 4ba22a3a33 Make setup.cfg release ready, move to GitHub 2020-08-16 19:58:55 +02:00
Sebastian Lohff 34a3279e2f Improve README.md a tiny bit 2020-08-16 15:13:22 +02:00
Sebastian Lohff f20b5eac89 Add more examples 2020-08-16 14:24:47 +02:00
Sebastian Lohff 9b833db364 Check type of options passed to __init__ 2020-08-05 03:09:24 +02:00
Sebastian Lohff c74e3d68d6 Implement multiple selections with CliMultiMenu
CliMultiMenu works much in the same way as CliMenu but it allows for
selecting multiple items.
2020-08-05 02:49:05 +02:00
Sebastian Lohff 46a863b3cf Remove broken space keyboard binding for accept
Originally space was thought out to also accept the selection, but only
a broken binding was added. As we want to use space for selections in
the future we now remove it entirely.
2020-08-05 02:34:36 +02:00
Sebastian Lohff a28c76e001 Allow a default theme and cursor to be set 2020-08-05 02:32:33 +02:00
Sebastian Lohff 45d3395642 Rename add_header() to add_text()
add_header() does not necessarily add a header, it might be just text.
2020-07-22 02:08:53 +02:00
Sebastian Lohff a17f7693e9 Renamed CLI_* cursors to ASCII_* cursors 2020-07-22 02:07:45 +02:00
Sebastian Lohff 648d5c956e Use option text as title if no value is given
If the user only supplys a text for the option we used to return None as
item value. Now we return the text, so the user can easily get the value
back if they want to process it further and not only work with the given
option index (or supply the item twice).
2020-03-11 18:19:19 +01:00
Sebastian Lohff 8c6ee790bf Fix get_options() and num_options to work on options
get_options() and num_options used to work on all menu items, including
blank spaces and headers. Now these work only on options, as they were
originally intended
2020-03-11 18:18:26 +01:00
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