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

Support ANSI rewrite sequences #4225

Open
luispadron opened this issue Jan 29, 2025 · 0 comments
Open

Support ANSI rewrite sequences #4225

luispadron opened this issue Jan 29, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@luispadron
Copy link

Is your feature request related to a problem? Please describe.

We have a git hook that displays some progress on a long running task, it does this progress message using ANSI escape codes to rewrite the previous line. When running this hook via LazyGit during a push the line escape codes are written literally so they do not function as expected.

Describe the solution you'd like

Ideally, the output capturing for hooks would handle all valid ANSI escapes.

Additional context

Example:

# .git/hooks/pre-push

# Print 1 line then re-write it using ANSI escape codes
>&2 echo -e "Line one (should not be visible)"
>&2 echo -e "\033[1A\033[KLine two"

if [ -t 0 ]; then
  >&2 echo "  --> Attached to a terminal"
else
  >&2 echo "  --> Not attached to a terminal"
fi

>&2 echo "If you see 'Line two' then things are working as expected"
exit 1

Image

@luispadron luispadron added the enhancement New feature or request label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant