Adds new script to retrieve bash escape codes
This commit is contained in:
		
							parent
							
								
									00c2bdc988
								
							
						
					
					
						commit
						b0d017e15c
					
				
					 1 changed files with 38 additions and 0 deletions
				
			
		
							
								
								
									
										38
									
								
								.escape_codes_bash.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								.escape_codes_bash.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| #!/usr/bin/python | ||||
| 
 | ||||
| """ | ||||
| Forward and Backward lookups for Bash escape sequences | ||||
| """ | ||||
| 
 | ||||
| import sys, re | ||||
| 
 | ||||
| 
 | ||||
| literal_to_bash = { | ||||
|   'ESC': '^[', | ||||
| 
 | ||||
|   'UP-ARROW': '^[OA', | ||||
|   'RIGHT-ARROW': '^[OC', | ||||
|   'DOWN-ARROW': '^[OB', | ||||
|   'LEFT-ARROW': '^[OD', | ||||
| 
 | ||||
|   'F1': '^[OP', | ||||
|   'F2': '^[OQ', | ||||
|   'F3': '^[OR', | ||||
|   'F4': '^[OS', | ||||
|   'F5': '^[15~', | ||||
|   'F6': '^[17~', | ||||
|   'F7': '^[18~', | ||||
|   'F8': '^[19~', | ||||
|   'F9': '^[20~', | ||||
|   'F10': '^[21~', | ||||
|   'F11': None, | ||||
|   'F12': '^[24~' | ||||
| } | ||||
| 
 | ||||
| bash_to_literal = { | ||||
|   v: k for k, v in literal_to_bash.items() | ||||
| } | ||||
| 
 | ||||
| el = sys.argv[1] | ||||
| 
 | ||||
| print '{0}: "{1}"'.format(el, literal_to_bash[el]) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue