mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-06-20 19:57:46 +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
|
# bat-extras | Copyright (C) 2020 eth-p | MIT License
|
||||||
#
|
#
|
||||||
# Repository: https://github.com/eth-p/bat-extras
|
# Repository: https://github.com/eth-p/bat-extras
|
||||||
# Issues: https://github.com/eth-p/bat-extras/issues
|
# Issues: https://github.com/eth-p/bat-extras/issues
|
||||||
# -----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Gets the width of the terminal.
|
# Gets the width of the terminal.
|
||||||
# This will return 80 unless stdin is attached to the terminal.
|
# This will return 80 unless stdin is attached to the terminal.
|
||||||
@ -21,3 +21,8 @@ term_width() {
|
|||||||
fi
|
fi
|
||||||
return 0
|
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…
x
Reference in New Issue
Block a user