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

Remove dependency #161

Open
diachedelic opened this issue Apr 1, 2022 · 0 comments
Open

Remove dependency #161

diachedelic opened this issue Apr 1, 2022 · 0 comments

Comments

@diachedelic
Copy link

Hello, and thanks for the great script. I wanted to include it in my project, but noticed that a dependency on a third party package (colorama) had crept in there, which I fear will complicate installation. Considering beautysh is only 400 lines, it seems a shame to introduce a dependency unnecessarily.

Upon investigation, I discovered that this dependency becomes completely unnecessary if the color_diff function is rewritten as

    def color_diff(self, diff):
        for line in diff:
            if line.startswith("+"):
                yield "\033[32m" + line + "\033[39m" # green
            elif line.startswith("-"):
                yield "\033[31m" + line + "\033[39m" # red
            elif line.startswith("^"):
                yield "\033[34m" + line + "\033[39m" # blue
            else:
                yield line
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

No branches or pull requests

1 participant