Add shellify
This commit is contained in:
		
							parent
							
								
									8146e336d7
								
							
						
					
					
						commit
						9908181467
					
				| @ -56,6 +56,7 @@ install (FILES fancontrol-ng.conf.example | ||||
| 
 | ||||
| install (TARGETS dwmstatus brightness fancontrol-ng | ||||
| 	DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||||
| install (PROGRAMS shellify DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||||
| install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) | ||||
| 
 | ||||
| # CPack | ||||
|  | ||||
| @ -12,6 +12,8 @@ to other people as well. | ||||
|  - 'fancontrol-ng' is a clone of fancontrol that can handle errors on resume | ||||
|    from suspend instead of setting fans to maximum speed and quitting; | ||||
|    in general it doesn't handle everything the original does | ||||
|  - 'shellify' is a simple script that sets up a shell for commands like vgdb | ||||
|    and nmcli that are painfully lacking it | ||||
| 
 | ||||
| Don't expect them to work under any OS that isn't Linux. | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										24
									
								
								shellify
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										24
									
								
								shellify
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,24 @@ | ||||
| #!/usr/bin/env python3 | ||||
| # Runs a special shell prepending a given command | ||||
| 
 | ||||
| import sys | ||||
| import os | ||||
| import readline | ||||
| import itertools | ||||
| 
 | ||||
| prefix = ' '.join (sys.argv[1:]) | ||||
| readline.parse_and_bind ('TAB: complete') | ||||
| for n in itertools.count (start=1): | ||||
| 	try: | ||||
| 		line = input ('\x1b[1m%s %d>\x1b[0m ' % (prefix, n)) | ||||
| 		if line == '': | ||||
| 			continue | ||||
| 
 | ||||
| 		readline.add_history (line) | ||||
| 		os.system (prefix + ' ' + line) | ||||
| 	except (EOFError, KeyboardInterrupt) as err: | ||||
| 		print ('') | ||||
| 		break | ||||
| 	except Exception as err: | ||||
| 		print ('%s\n' % err) | ||||
| 
 | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user