mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	refact(shells): add specific app_alias methods for Bash and Zsh
				
					
				
			Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
This commit is contained in:
		| @@ -49,6 +49,9 @@ class Generic(object): | |||||||
|  |  | ||||||
|  |  | ||||||
| class Bash(Generic): | class Bash(Generic): | ||||||
|  |     def app_alias(self): | ||||||
|  |         return "\nalias fuck='eval $(thefuck $(fc -ln -1)); history -r'\n" | ||||||
|  |  | ||||||
|     def _parse_alias(self, alias): |     def _parse_alias(self, alias): | ||||||
|         name, value = alias.replace('alias ', '', 1).split('=', 1) |         name, value = alias.replace('alias ', '', 1).split('=', 1) | ||||||
|         if value[0] == value[-1] == '"' or value[0] == value[-1] == "'": |         if value[0] == value[-1] == '"' or value[0] == value[-1] == "'": | ||||||
| @@ -71,6 +74,9 @@ class Bash(Generic): | |||||||
|  |  | ||||||
|  |  | ||||||
| class Zsh(Generic): | class Zsh(Generic): | ||||||
|  |     def app_alias(self): | ||||||
|  |         return "\nalias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R'\n" | ||||||
|  |  | ||||||
|     def _parse_alias(self, alias): |     def _parse_alias(self, alias): | ||||||
|         name, value = alias.split('=', 1) |         name, value = alias.split('=', 1) | ||||||
|         if value[0] == value[-1] == '"' or value[0] == value[-1] == "'": |         if value[0] == value[-1] == '"' or value[0] == value[-1] == "'": | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user