-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AnsiEscapeSequences class to help with some often used sequences
- Loading branch information
1 parent
14e6f4c
commit 79d760c
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodeLts\CliTools; | ||
|
||
/** | ||
* ANSI escape sequences | ||
* @see https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html | ||
* @see http://ascii-table.com/ansi-escape-sequences.php | ||
*/ | ||
class AnsiEscapeSequences | ||
{ | ||
/** | ||
* Move the cursor up 1 lines | ||
*/ | ||
public const MOVE_CURSOR_UP_1 = "\033[1A"; | ||
|
||
/** | ||
* Move the cursor up 2 lines | ||
*/ | ||
public const MOVE_CURSOR_UP_2 = "\033[2A"; | ||
|
||
/** | ||
* Move the cursor down 1 lines | ||
*/ | ||
public const MOVE_CURSOR_DOWN_1 = "\033[1B"; | ||
|
||
/** | ||
* Move the cursor down 2 lines | ||
*/ | ||
public const MOVE_CURSOR_DOWN_2 = "\033[2B"; | ||
|
||
/** | ||
* Erase to the end of the line on 2 lines | ||
*/ | ||
public const ERASE_TO_LINE_END_1 = "\033[2A"; | ||
|
||
/** | ||
* Erase to the end of the line on 2 lines | ||
*/ | ||
public const ERASE_TO_LINE_END_2 = "\033[2A"; | ||
|
||
/** | ||
* Clear the screen, move to (0,0) | ||
*/ | ||
public const CLEAR_SCREEN_MOVE_0_0 = "\033[2J"; | ||
} |