mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 07:04:12 +00:00 
			
		
		
		
	#294 Move entry point for alias to main
				
					
				
			This commit is contained in:
		
							
								
								
									
										2
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
									
									
									
									
								
							| @@ -31,4 +31,4 @@ setup(name='thefuck', | |||||||
|       extras_require=extras_require, |       extras_require=extras_require, | ||||||
|       entry_points={'console_scripts': [ |       entry_points={'console_scripts': [ | ||||||
|           'thefuck = thefuck.main:main', |           'thefuck = thefuck.main:main', | ||||||
|           'thefuck-alias = thefuck.shells:app_alias']}) |           'thefuck-alias = thefuck.main:print_alias']}) | ||||||
|   | |||||||
| @@ -128,6 +128,8 @@ def run_rule(rule, command, settings): | |||||||
|         print(new_command) |         print(new_command) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # Entry points: | ||||||
|  |  | ||||||
| def main(): | def main(): | ||||||
|     colorama.init() |     colorama.init() | ||||||
|     user_dir = setup_user_dir() |     user_dir = setup_user_dir() | ||||||
| @@ -151,3 +153,10 @@ def main(): | |||||||
|             return |             return | ||||||
|  |  | ||||||
|     logs.failed('No fuck given', settings) |     logs.failed('No fuck given', settings) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def print_alias(): | ||||||
|  |     alias = shells.thefuck_alias() | ||||||
|  |     if len(sys.argv) > 1: | ||||||
|  |         alias = sys.argv[1] | ||||||
|  |     print(shells.app_alias(alias)) | ||||||
|   | |||||||
| @@ -9,7 +9,6 @@ from subprocess import Popen, PIPE | |||||||
| from time import time | from time import time | ||||||
| import io | import io | ||||||
| import os | import os | ||||||
| import sys |  | ||||||
| from .utils import DEVNULL, memoize | from .utils import DEVNULL, memoize | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -242,11 +241,8 @@ def to_shell(command): | |||||||
|     return _get_shell().to_shell(command) |     return _get_shell().to_shell(command) | ||||||
|  |  | ||||||
|  |  | ||||||
| def app_alias(): | def app_alias(alias): | ||||||
|     alias = thefuck_alias() |     return _get_shell().app_alias(alias) | ||||||
|     if len(sys.argv) > 1: |  | ||||||
|         alias = sys.argv[1] |  | ||||||
|     print(_get_shell().app_alias(alias)) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def thefuck_alias(): | def thefuck_alias(): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user