mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-10-05 01:11:57 +02:00
lib: Add 'term_clear' function to clear the terminal screen
This commit is contained in:
parent
93e2e4d048
commit
e16e05d1d4
@ -1,9 +1,9 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# bat-extras | Copyright (C) 2020 eth-p | MIT License
|
||||
#
|
||||
# Repository: https://github.com/eth-p/bat-extras
|
||||
# Issues: https://github.com/eth-p/bat-extras/issues
|
||||
# -----------------------------------------------------------------------------
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# Gets the width of the terminal.
|
||||
# This will return 80 unless stdin is attached to the terminal.
|
||||
@ -21,3 +21,8 @@ term_width() {
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Clears the terminal using the ANSI escape sequences for erase screen and cursor absolute positioning.
|
||||
term_clear() {
|
||||
printf "\x1B[3J\x1B[2J\x1B[H"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user