=======
pimento
=======
Use python? Use the CLI? Ever prompt a user to select an option? I have just the module for you!
``pimento`` is a simple CLI menu module for python. It also comes with a standalone command-line executable of the same name.
* `examples`_
* `features`_
* `cli`_
* `installation`_
* `testing`_
* `API deprecation notices`_
examples
========
simple CLI menu prompting
-------------------------
There is a single required argument:
* items - a finite iterable (list, tuple, etc) of items which the user will be prompted to choose from
.. code:: python
from pimento import menu
result = menu(['red', 'blue', 'green', 'grey'])
Prints:
::
Options:
red
blue
green
grey
Enter an option to continue:
Entering ``r`` results in ``red`` being returned from the function.
User input is matched case-sensitively from the beginning of each option. Ambiguous, null, and invalid entries are handled, an error message displayed, and the menu reprompted automatically.
This is the simplest, default usage. For more options, see the following example and the `features`_ list.
cli menu with all the features
------------------------------
* custom pre-prompt
* custom post-prompt
* indexing
* default selection
* case-insensitivity
* 'fuzzy' matching
* deduplication
* removal of empty items
.. code:: python
from pimento import menu
result = menu(
['', 'RED', 'Red', 'blue', 'green', 'grey', 'green', 'light URPLE'],
pre_prompt='Available colors:',
post_prompt='Please select a color [{}]',
default_index=3,
indexed=True,
insensitive=True,
fuzzy=True
)
Prints:
::
Available colors:
[0] RED
[1] blue
[2] green
[3] grey
[4] light URPLE
Please select a color [blue]:
Entering ``urple`` will result in the function returning ``light URPLE``.
features
========
* Sane defaults (see the `simple cli menu prompting`_ example)
* `custom pre-prompt`_
* `custom post-prompt`_
* `partial matches`_
* `re-prompting`_
* `tab-completion`_
* `using a default`_
* `using indices`_
* `deduplication`_
* `removal of empty items`_
* `strips trailing whitespace`_
* `case-insensitivity`_
* `arrow keys`_
* `fuzzy matching`_
custom pre-prompt
-----------------
You may specify any pre-prompt you wish to appear before the list of options:
.. code:: python
from pimento import menu
result = menu(
['red', 'blue', 'green', 'grey'],
pre_prompt="Which color?"
)
Prints:
::
Which color?
red
blue
green
grey
Enter an option to continue:
custom post-prompt
------------------
You may specify any post-propmt you wish to appear after the list of options:
.. code:: python
from pimento import menu
result = menu(
['red', 'blue', 'green', 'grey'],
post_prompt="Please select one: "
)
Prints:
::
Options:
red
blue
green
grey
Please select one:
partial matches
---------------
The user can select either a full option or a partial match. All of the following will result in the user selecting ``blue``:
* ``b``
* ``bl``
* ``blu``
* ``blue``
re-prompting
------------
When an invalid option is entered, an actionable error message is printed, and the menu is re-prompted.
when no choice is entered:
~~~~~~~~~~~~~~~~~~~~~~~~~~
::
which color?
red
blue
green
grey
Please select one:
[!] an empty response is not valid.
when an invalid choice is entered:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
which color?
red
blue
green
grey
Please select one: brown
[!] "brown" does not match any of the valid choices.
when an ambiguous choice is entered:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If ``gre`` was entered...
::
which color?
red
blue
green
grey
Please select one: gre
[!] "gre" matches multiple choices:
[!] green
[!] grey
[!] Please specify your choice further.
tab-completion
--------------
Tab completion of options is supported! At the moment, this is supported via ``readline``, so this is a \*nix-only feature.
Arrow-key navigation of history and current line is also supported via the ``readline`` library.
using a default
---------------
``menu`` will accept a default_index keyword argument. ``items[default_index]`` must be valid. An invalid index will result in an exception being raised at call time.
.. code:: python
from pimento import menu
result = menu(
['red', 'blue', 'green'],
"which color?",
"Please select one [{}]: ",
default_index=0
)
Prints:
::
which color?
red
blue
green
Please select one [red]:
When a default_index is provided, it is valid to enter no value. In this case, the default value (``red``, in this example) is returned.
When a default_index is provided, if ``{}`` is present in the post-prompt, it will be replaced with the value of ``items[default_index]``. It is recommended, but not required, that if you set a default_index, you should display the default value to the users via this substitution mechanism.
using indices
-------------
``menu`` will accept an ``indexed`` argument. When set to ``True``, indices will be printed with each option, and it will be valid to enter an index to choose an option.
.. code:: python
from pimento import menu
result = menu(
['red', 'blue', 'green'],
"which color?",
"Please select one [{}]: ",
default_index=0,
indexed=True
)
Prints:
::
which color?
[0] red
[1] blue
[2] green
Please select one [red]:
Choosing any of the following will return ``red``:
* \<enter\> (to select the default)
* ``r``
* ``re``
* ``red``
* 0 (index)
When using indices, the selection is matched first by index, then by item. Given the following menu...
::
which number?
[0] 100
[1] 200
[2] 300
Please select one:
...the selection/result pairs are:
* 0 -> 100 (selection treated as index)
* 1 -> 200 (selection treated as index)
* 2 -> 300 (selection treated as index)
* 3 -> 300 (selection matched no index, matched against items)
* 10 -> 100 (selection matched no index, matched against items)
* 20 -> 200 (selection matched no index, matched against items)
* 30 -> 300 (selection matched no index, matched against items)
deduplication
-------------
If you pass multiple matching items into ``menu``, it will deduplicate them for you. This is to prevent the following scenario:
::
pimento foo foo
Options:
foo
foo
Please select an option: foo
[!] "foo" matches multiple choices:
[!] foo
[!] foo
[!] Please specify your choice further.
You can't specify a choice any further in this case, so ``pimento`` deduplicates the list for you.
If you expect your list of items not to need deduplication, and you care about duplicates, you should check for them prior to calling ``menu``.
The default index, if specified, will be used to select the default from the list prior to deduplication:
::
pimento bar foo foo -d 2
Options:
bar
foo
Please select an option [foo]: <enter>
In the above example, ``pimento`` prints 'foo' to stdout.
removal of empty items
----------------------
If you pass empty items into ``menu``, it will remove them for you. This is to prevent the following scenario:
::
pimento ''
Options:
Please select an option: <enter>
[!] an empty response is not valid.
Options:
Please select an option:
You can't specify an empty choice, and an empty choice doesn't make sense anyway, so ``pimento`` removes them for you.
If all you had was empty choices, the call will fail with a ValueError about the list being empty.
If you expect your list of items not to need removal of empty items, and you care if there are any, you should check that prior to calling ``menu``.
The default index, if specified, will be used to select the default from the list prior to removal of empty items:
::
pimento '' bar foo -d 2
Options:
bar
foo
Please select an option [foo]: <enter>
In the above example, ``pimento`` prints 'foo' to stdout.
strips trailing whitespace
--------------------------
Trailing whitespace is stripped from each option passed in.
A whitespace item is defined for ``pimento`` as it is by python - typically space, tab, newline, carriage return.
* If stripping whitespace means that the item becomes a duplicate of another item, it will be removed according to the description in `deduplication`_.
* If it means that the item becomes empty it is removed according to the description in `removal of empty items`_.
case-insensitivity
------------------
``menu`` will accept an ``insensitive`` argument, which will make the menu match user input to the menu options in a case-insensitive manner.
.. code:: python
from pimento import menu
result = menu(
['RED', 'Blue', 'green'],
insensitive=True
)
Prints:
::
Options:
RED
Blue
green
Enter an option to continue:
Entering ``red`` will get you ``RED``, ``blue`` will get you ``Blue``, and ``GREEN`` will get you ``green``.
fuzzy matching
--------------
``menu`` will accept a ``fuzzy`` argument, which will make the menu search for the words in the user input in the words of the item string,
rather than just matching the user input from the start of the option:
.. code:: python
from pimento import menu
result = menu(
['a blue thing', 'one green thing'],
fuzzy=True
)
Prints:
::
Options:
a blue thing
one green thing
Enter an option to continue:
Entering ``thing n`` will return ``one green thing``.
This method matches ``thing`` to both options (both contain the full word ``thing``), then matches ``n`` only to ``one green thing``,
because that's the only option with an unmatched ``n`` (in both ``one`` and ``green``).
arrow keys
----------
When running in a \*nix environment, ``menu`` will use the Gnu ``readline`` library to provide support for command history and the use of arrow keys to edit entered text:
::
Options:
foo
Enter an option to continue: oo
[!] "oo" does not match any of the valid choices.
Options:
foo
Enter an option to continue: <up><left><left>f<enter>
foo
In the above example, the user hit ``<up>``, which brought back 'oo' and put the cursor at the end. They then hit ``<left>`` twice to get the cursor back to the beginning of the word, inserted 'f' to spell the valid option 'foo', and hit enter.
CLI
===
There is a standalone CLI tool of the same name (``pimento``), which is a wrapper for ``pimento.menu``, and can be used to create simple menus quickly on the command line:
::
pimento --help
usage: pimento [-h] [--pre TEXT] [--post TEXT] [--default-index INT]
[--indexed]
[option ...]
Present the user with a simple CLI menu, and return the option chosen. The
menu is presented via stderr. The output is printed to stdout for piping.
positional arguments:
option The option(s) to present to the user.
optional arguments:
-h, --help show this help message and exit
--pre TEXT, -p TEXT The pre-prompt/title/introduction to the menu.
[Options:]
--post TEXT, -P TEXT The prompt presented to the user after the menu items.
--default-index INT, -d INT
The index of the item to use as the default
--indexed, -i Print indices with the options, and allow the user to
use them to choose.
--insensitive, -I Perform insensitive matching. Also drops any items
that case-insensitively match prior items.
--fuzzy, -f search for the individual words in the user input anywhere in the item strings.
The default for the post prompt is "Enter an option to continue: ". If
--default-index is specified, the default option value will be printed in the
post prompt as well.
On \*nix, the CLI tool is capable of taking options from a pipe, like so:
::
echo -e 'foo\nbar' | pimento
Options:
foo
bar
Enter an option to continue:
installation
============
Latest pushed to Pypi_ (v0.7.1_)
.. _Pypi: https://pypi.python.org/pypi/pimento
.. _v0.7.1: https://github.com/toejough/pimento/releases/tag/v0.7.1
::
pip install pimento
Latest
::
pip install git+https://github.com/toejough/pimento
testing
=======
pimento has been tested on python 2.7.9 and 3.4.3 on OSX. To test yourself:
::
git clone https://github.com/toejough/pimento
cd pimento
pip install tox
tox
API deprecation notices
=======================
Prompt ordering
---------------
Prior to version 0.4.0, the signature for ``menu`` was:
.. code:: python
def menu(pre_prompt, items, post_prompt=DEFAULT, default_index=None, indexed=False):
In v0.4.0, the signature changed to:
.. code:: python
def menu(items, pre_prompt=DEFAULT, post_prompt=DEFAULT, default_index=None, indexed=False):
To ease transition of any users, there is special code in place to determine which order the caller is passing in ``items`` and ``pre_prompt``. All pre-0.4.0 code should continue to work, but passing ``pre_prompt`` as the first argument is a deprecated use and should be discontinued. Old code should be updated. The compatibility mode will be discontinued soon, but definitely by 1.0.0.
The API was changed to allow the simplest possible calling/use of the ``menu`` function. The original signature was chosen because I thought that there wasn't a sensible default value, but "Options:" seems sensible enough for a generic default.
Search matching
---------------
As of version 0.6.0, the ``search`` method of matching is deprecated. It will be removed within a few releases, but definitely by v1.0.0.
``fuzzy`` matching matches the same cases, and is more versatile.
Raw data
{
"_id": null,
"home_page": "https://github.com/toejough/pimento",
"name": "pimento",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "menu cli",
"author": "toejough",
"author_email": "toejough@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e1/b6/1b9cb1653aa45c9ff38bafcaced95ddb5cb1a888bfe2d1dcb130f0bcc764/pimento-0.7.1.tar.gz",
"platform": "UNKNOWN",
"description": "=======\npimento\n=======\n\nUse python? Use the CLI? Ever prompt a user to select an option? I have just the module for you!\n\n``pimento`` is a simple CLI menu module for python. It also comes with a standalone command-line executable of the same name.\n\n* `examples`_\n* `features`_\n* `cli`_\n* `installation`_\n* `testing`_\n* `API deprecation notices`_\n\nexamples\n========\n\nsimple CLI menu prompting\n-------------------------\n\nThere is a single required argument:\n\n* items - a finite iterable (list, tuple, etc) of items which the user will be prompted to choose from\n\n.. code:: python\n\n from pimento import menu\n result = menu(['red', 'blue', 'green', 'grey'])\n\nPrints:\n::\n\n Options:\n red\n blue\n green\n grey\n Enter an option to continue: \n\nEntering ``r`` results in ``red`` being returned from the function.\n\nUser input is matched case-sensitively from the beginning of each option. Ambiguous, null, and invalid entries are handled, an error message displayed, and the menu reprompted automatically.\n\nThis is the simplest, default usage. For more options, see the following example and the `features`_ list.\n\ncli menu with all the features\n------------------------------\n\n* custom pre-prompt\n* custom post-prompt\n* indexing\n* default selection\n* case-insensitivity\n* 'fuzzy' matching\n* deduplication\n* removal of empty items\n\n.. code:: python\n\n from pimento import menu\n result = menu(\n ['', 'RED', 'Red', 'blue', 'green', 'grey', 'green', 'light URPLE'],\n pre_prompt='Available colors:',\n post_prompt='Please select a color [{}]',\n default_index=3,\n indexed=True,\n insensitive=True,\n fuzzy=True\n )\n\nPrints:\n::\n\n Available colors:\n [0] RED\n [1] blue\n [2] green\n [3] grey\n [4] light URPLE\n Please select a color [blue]: \n\nEntering ``urple`` will result in the function returning ``light URPLE``.\n\nfeatures\n========\n\n* Sane defaults (see the `simple cli menu prompting`_ example)\n* `custom pre-prompt`_\n* `custom post-prompt`_\n* `partial matches`_\n* `re-prompting`_\n* `tab-completion`_\n* `using a default`_\n* `using indices`_\n* `deduplication`_\n* `removal of empty items`_\n* `strips trailing whitespace`_\n* `case-insensitivity`_\n* `arrow keys`_\n* `fuzzy matching`_\n\ncustom pre-prompt\n-----------------\n\nYou may specify any pre-prompt you wish to appear before the list of options:\n\n.. code:: python\n\n from pimento import menu\n result = menu(\n ['red', 'blue', 'green', 'grey'],\n pre_prompt=\"Which color?\"\n )\n\nPrints:\n::\n\n Which color?\n red\n blue\n green\n grey\n Enter an option to continue: \n\ncustom post-prompt\n------------------\n\nYou may specify any post-propmt you wish to appear after the list of options:\n\n.. code:: python\n\n from pimento import menu\n result = menu(\n ['red', 'blue', 'green', 'grey'],\n post_prompt=\"Please select one: \"\n )\n\nPrints:\n::\n\n Options:\n red\n blue\n green\n grey\n Please select one:\n\npartial matches\n---------------\n\nThe user can select either a full option or a partial match. All of the following will result in the user selecting ``blue``:\n\n* ``b``\n* ``bl``\n* ``blu``\n* ``blue``\n\nre-prompting\n------------\n\nWhen an invalid option is entered, an actionable error message is printed, and the menu is re-prompted.\n\nwhen no choice is entered:\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n which color?\n red\n blue\n green\n grey\n Please select one: \n [!] an empty response is not valid.\n\nwhen an invalid choice is entered:\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n which color?\n red\n blue\n green\n grey\n Please select one: brown\n [!] \"brown\" does not match any of the valid choices.\n\nwhen an ambiguous choice is entered:\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf ``gre`` was entered...\n::\n\n which color?\n red\n blue\n green\n grey\n Please select one: gre\n [!] \"gre\" matches multiple choices:\n [!] green\n [!] grey\n [!] Please specify your choice further.\n\ntab-completion\n--------------\n\nTab completion of options is supported! At the moment, this is supported via ``readline``, so this is a \\*nix-only feature.\nArrow-key navigation of history and current line is also supported via the ``readline`` library.\n\n\nusing a default\n---------------\n\n``menu`` will accept a default_index keyword argument. ``items[default_index]`` must be valid. An invalid index will result in an exception being raised at call time.\n\n.. code:: python\n\n from pimento import menu\n result = menu(\n ['red', 'blue', 'green'],\n \"which color?\",\n \"Please select one [{}]: \",\n default_index=0\n )\n\nPrints:\n::\n\n which color?\n red\n blue\n green\n Please select one [red]: \n\nWhen a default_index is provided, it is valid to enter no value. In this case, the default value (``red``, in this example) is returned.\n\nWhen a default_index is provided, if ``{}`` is present in the post-prompt, it will be replaced with the value of ``items[default_index]``. It is recommended, but not required, that if you set a default_index, you should display the default value to the users via this substitution mechanism.\n\nusing indices\n-------------\n\n``menu`` will accept an ``indexed`` argument. When set to ``True``, indices will be printed with each option, and it will be valid to enter an index to choose an option.\n\n.. code:: python\n\n from pimento import menu\n result = menu(\n ['red', 'blue', 'green'],\n \"which color?\",\n \"Please select one [{}]: \",\n default_index=0,\n indexed=True\n )\n\nPrints:\n::\n\n which color?\n [0] red\n [1] blue\n [2] green\n Please select one [red]: \n\nChoosing any of the following will return ``red``:\n\n* \\<enter\\> (to select the default)\n* ``r``\n* ``re``\n* ``red``\n* 0 (index)\n\nWhen using indices, the selection is matched first by index, then by item. Given the following menu...\n::\n\n which number?\n [0] 100\n [1] 200\n [2] 300\n Please select one:\n\n...the selection/result pairs are:\n\n* 0 -> 100 (selection treated as index)\n* 1 -> 200 (selection treated as index)\n* 2 -> 300 (selection treated as index)\n* 3 -> 300 (selection matched no index, matched against items)\n* 10 -> 100 (selection matched no index, matched against items)\n* 20 -> 200 (selection matched no index, matched against items)\n* 30 -> 300 (selection matched no index, matched against items)\n\ndeduplication\n-------------\n\nIf you pass multiple matching items into ``menu``, it will deduplicate them for you. This is to prevent the following scenario:\n::\n\n pimento foo foo\n Options:\n foo\n foo\n Please select an option: foo\n [!] \"foo\" matches multiple choices:\n [!] foo\n [!] foo\n [!] Please specify your choice further.\n\nYou can't specify a choice any further in this case, so ``pimento`` deduplicates the list for you.\nIf you expect your list of items not to need deduplication, and you care about duplicates, you should check for them prior to calling ``menu``.\n\nThe default index, if specified, will be used to select the default from the list prior to deduplication:\n::\n\n pimento bar foo foo -d 2\n Options:\n bar\n foo\n Please select an option [foo]: <enter>\n\nIn the above example, ``pimento`` prints 'foo' to stdout.\n\nremoval of empty items\n----------------------\n\nIf you pass empty items into ``menu``, it will remove them for you. This is to prevent the following scenario:\n::\n\n pimento ''\n Options:\n\n Please select an option: <enter>\n [!] an empty response is not valid.\n Options:\n\n Please select an option: \n\nYou can't specify an empty choice, and an empty choice doesn't make sense anyway, so ``pimento`` removes them for you.\nIf all you had was empty choices, the call will fail with a ValueError about the list being empty.\nIf you expect your list of items not to need removal of empty items, and you care if there are any, you should check that prior to calling ``menu``.\n\nThe default index, if specified, will be used to select the default from the list prior to removal of empty items:\n::\n\n pimento '' bar foo -d 2\n Options:\n bar\n foo\n Please select an option [foo]: <enter>\n\nIn the above example, ``pimento`` prints 'foo' to stdout.\n\nstrips trailing whitespace\n--------------------------\n\nTrailing whitespace is stripped from each option passed in.\nA whitespace item is defined for ``pimento`` as it is by python - typically space, tab, newline, carriage return.\n\n* If stripping whitespace means that the item becomes a duplicate of another item, it will be removed according to the description in `deduplication`_.\n* If it means that the item becomes empty it is removed according to the description in `removal of empty items`_.\n\ncase-insensitivity\n------------------\n\n``menu`` will accept an ``insensitive`` argument, which will make the menu match user input to the menu options in a case-insensitive manner.\n\n.. code:: python\n\n from pimento import menu\n result = menu(\n ['RED', 'Blue', 'green'],\n insensitive=True\n )\n\nPrints:\n::\n\n Options:\n RED\n Blue\n green\n Enter an option to continue: \n\nEntering ``red`` will get you ``RED``, ``blue`` will get you ``Blue``, and ``GREEN`` will get you ``green``.\n\nfuzzy matching\n--------------\n\n``menu`` will accept a ``fuzzy`` argument, which will make the menu search for the words in the user input in the words of the item string,\nrather than just matching the user input from the start of the option:\n\n.. code:: python\n\n from pimento import menu\n result = menu(\n ['a blue thing', 'one green thing'],\n fuzzy=True\n )\n\nPrints:\n::\n\n Options:\n a blue thing\n one green thing\n Enter an option to continue: \n\nEntering ``thing n`` will return ``one green thing``.\n\nThis method matches ``thing`` to both options (both contain the full word ``thing``), then matches ``n`` only to ``one green thing``,\nbecause that's the only option with an unmatched ``n`` (in both ``one`` and ``green``).\n\narrow keys\n----------\n\nWhen running in a \\*nix environment, ``menu`` will use the Gnu ``readline`` library to provide support for command history and the use of arrow keys to edit entered text:\n::\n\n Options:\n foo\n Enter an option to continue: oo\n [!] \"oo\" does not match any of the valid choices.\n Options:\n foo\n Enter an option to continue: <up><left><left>f<enter>\n foo\n\nIn the above example, the user hit ``<up>``, which brought back 'oo' and put the cursor at the end. They then hit ``<left>`` twice to get the cursor back to the beginning of the word, inserted 'f' to spell the valid option 'foo', and hit enter.\n\nCLI\n===\n\nThere is a standalone CLI tool of the same name (``pimento``), which is a wrapper for ``pimento.menu``, and can be used to create simple menus quickly on the command line:\n::\n\n pimento --help\n usage: pimento [-h] [--pre TEXT] [--post TEXT] [--default-index INT]\n [--indexed]\n [option ...]\n\n Present the user with a simple CLI menu, and return the option chosen. The\n menu is presented via stderr. The output is printed to stdout for piping.\n\n positional arguments:\n option The option(s) to present to the user.\n\n optional arguments:\n -h, --help show this help message and exit\n --pre TEXT, -p TEXT The pre-prompt/title/introduction to the menu.\n [Options:]\n --post TEXT, -P TEXT The prompt presented to the user after the menu items.\n --default-index INT, -d INT\n The index of the item to use as the default\n --indexed, -i Print indices with the options, and allow the user to\n use them to choose.\n --insensitive, -I Perform insensitive matching. Also drops any items\n that case-insensitively match prior items.\n --fuzzy, -f search for the individual words in the user input anywhere in the item strings.\n\n The default for the post prompt is \"Enter an option to continue: \". If\n --default-index is specified, the default option value will be printed in the\n post prompt as well.\n\nOn \\*nix, the CLI tool is capable of taking options from a pipe, like so:\n::\n\n echo -e 'foo\\nbar' | pimento\n Options:\n foo\n bar\n Enter an option to continue:\n\n\ninstallation\n============\n\nLatest pushed to Pypi_ (v0.7.1_)\n\n.. _Pypi: https://pypi.python.org/pypi/pimento\n.. _v0.7.1: https://github.com/toejough/pimento/releases/tag/v0.7.1\n\n::\n\n pip install pimento\n\nLatest\n::\n\n pip install git+https://github.com/toejough/pimento\n\ntesting\n=======\n\npimento has been tested on python 2.7.9 and 3.4.3 on OSX. To test yourself:\n::\n\n git clone https://github.com/toejough/pimento\n cd pimento\n pip install tox\n tox\n\nAPI deprecation notices\n=======================\n\nPrompt ordering\n---------------\n\nPrior to version 0.4.0, the signature for ``menu`` was:\n\n.. code:: python\n\n def menu(pre_prompt, items, post_prompt=DEFAULT, default_index=None, indexed=False):\n\nIn v0.4.0, the signature changed to:\n\n.. code:: python\n\n def menu(items, pre_prompt=DEFAULT, post_prompt=DEFAULT, default_index=None, indexed=False):\n\nTo ease transition of any users, there is special code in place to determine which order the caller is passing in ``items`` and ``pre_prompt``. All pre-0.4.0 code should continue to work, but passing ``pre_prompt`` as the first argument is a deprecated use and should be discontinued. Old code should be updated. The compatibility mode will be discontinued soon, but definitely by 1.0.0.\n\nThe API was changed to allow the simplest possible calling/use of the ``menu`` function. The original signature was chosen because I thought that there wasn't a sensible default value, but \"Options:\" seems sensible enough for a generic default.\n\nSearch matching\n---------------\n\nAs of version 0.6.0, the ``search`` method of matching is deprecated. It will be removed within a few releases, but definitely by v1.0.0.\n\n``fuzzy`` matching matches the same cases, and is more versatile.",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple CLI Menus",
"version": "0.7.1",
"project_urls": {
"Homepage": "https://github.com/toejough/pimento"
},
"split_keywords": [
"menu",
"cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "32cdbc83e1782b5e48aa18b906efacea78690671a81ebbcc7cf1a5365f1239f0",
"md5": "edc9f404729b097ac01bbd35f355362b",
"sha256": "bb92b0984817d8f630efdb3d42a6c8c4d57d824fabb7084aed0b0456077b603f"
},
"downloads": -1,
"filename": "pimento-0.7.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "edc9f404729b097ac01bbd35f355362b",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 17183,
"upload_time": "2015-06-05T02:07:52",
"upload_time_iso_8601": "2015-06-05T02:07:52.105587Z",
"url": "https://files.pythonhosted.org/packages/32/cd/bc83e1782b5e48aa18b906efacea78690671a81ebbcc7cf1a5365f1239f0/pimento-0.7.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e1b61b9cb1653aa45c9ff38bafcaced95ddb5cb1a888bfe2d1dcb130f0bcc764",
"md5": "3a2c95c277885a35558e545fccd3750e",
"sha256": "381b541babf3b5bd1cebcc8b1b44d54da20ec17a8e688118f1ac17e901679e18"
},
"downloads": -1,
"filename": "pimento-0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "3a2c95c277885a35558e545fccd3750e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12497,
"upload_time": "2015-06-05T02:07:55",
"upload_time_iso_8601": "2015-06-05T02:07:55.580678Z",
"url": "https://files.pythonhosted.org/packages/e1/b6/1b9cb1653aa45c9ff38bafcaced95ddb5cb1a888bfe2d1dcb130f0bcc764/pimento-0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2015-06-05 02:07:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "toejough",
"github_project": "pimento",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "pimento"
}