Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate options #74

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

edrogers
Copy link

By capitalizing the emoji single-letter option to -J, a collision between JSON and emoji display options is removed.

I also included a test that monkeypatches a private function of the click.decorators module to make it fail noisily when option names are duplicated. Could be useful if CI is implemented for this project.

Fixes #73

monkeypatch.setattr(click.decorators, "_param_memo", _param_memo_safe)

# import here (after monkeypatch) because decorators are run on import
from src.rich_cli.__main__ import main
Copy link

@harkabeeparolus harkabeeparolus Oct 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably shouldn't import from a module called "src". I believe that running pytest with a src directory layout works best if you install pytest into your virtual environment. If you change the line to from rich_cli.__main__ import main then this works:

poetry install
poetry add --group dev pytest
poetry run pytest

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚡ Works great

Copy link

@harkabeeparolus harkabeeparolus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reused option name: -j is used for both JSON and emoji options
2 participants