Closed svartkanin closed 2 years ago
Thank you very much for contributing! The changes look good to me. I have only some suggestions for minor improvements:
None
and empty strings for menu separators because empty strings could also be passed from the command line interface. Since None
is a special value which is invalid without your new flag, I think we could even always use None
as a separator entry. This simplifies the API usage.black
installation... I fixed this in the latest develop
, so this check should pass when you push again.README.md
file which describes your new flag. I use the README.md
as a documentation replacement. :innocent: Thanks for the quick review and reply. I'm happy to address them, probably towards the end of the weekend :)
@IngoMeyer441 I've updated the PR now:
None
as the separator I had issues running the black commit hook. I kept getting the following error
Traceback (most recent call last):
File ".cache/pre-commit/repootteniip/py_env-python3/bin/black", line 8, in <module>
sys.exit(patched_main())
File ".cache/pre-commit/repootteniip/py_env-python3/lib/python3.10/site-packages/black/__init__.py", line 1423, in patched_main
patch_click()
File ".cache/pre-commit/repootteniip/py_env-python3/lib/python3.10/site-packages/black/__init__.py", line 1409, in patch_click
from click import _unicodefun
ImportError: cannot import name '_unicodefun' from 'click' (.cache/pre-commit/repootteniip/py_env-python3/lib/python3.10/site-packages/click/__init__.py)
I updated the hook to the latest version of black and that resolved the issue
Thanks for your changes and your contribution. I tested your code and works fine! I applied some minor improvements to your PR:
None
as an empty menu entry (independently from skip_empty_entries
)skip_empty_entries
is
set to True
None
valueUnion[None, x]
with Optional[x]
I pushed a new commit to the svartkanin-skip-empty-entries
branch in this repository. You can apply (and review) the changes with:
git fetch https://github.com/IngoMeyer441/simple-term-menu.git svartkanin-skip-empty-entries
git cherry-pick FETCH_HEAD
If the changes are ok for you, simply push the commit to this PR and I will merge it. Otherwise, please let me know. I am always open for discussion. :slightly_smiling_face:
Thanks again and have a nice weekend! :beers:
@IngoMeyer441 thanks for the updates, I've tested things and it seems to work as expected :+1:
This addresses #45
I created a new menu option
skip_empty_entries
that when set will skip over empty entries in the menu.Skip-able entries can either be defined with empty string or as None. The new option is set to
False
as default, so if empty or None values or specified it will fail as it does now. But if the option is set toTrue
it will skip the entries when iterating through the menu. This will allow for grouping menu options together visually.I've tested it with single selection and multiselection.