1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-18 12:06:04 +00:00

#1 Don't fuck twice

This commit is contained in:
nvbn 2015-04-17 22:09:46 +02:00
parent 636ce7c507
commit 48831fa850
2 changed files with 16 additions and 8 deletions

View File

@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(name='thefuck',
version=1.4,
version=1.5,
description="Magnificent app which corrects your previous console command",
author='Vladimir Iakovlev',
author_email='nvbn.rm@gmail.com',

View File

@ -74,13 +74,21 @@ def run_rule(rule, command, settings):
print(new_command)
def is_second_run(command):
"""It's second run of `fuck`?"""
return command.script.startswith('fuck')
def main():
command = get_command(sys.argv)
user_dir = setup_user_dir()
settings = get_settings(user_dir)
rules = get_rules(user_dir, settings)
matched_rule = get_matched_rule(command, rules, settings)
if matched_rule:
run_rule(matched_rule, command, settings)
if is_second_run(command):
print("echo Can't fuck twice")
else:
print('echo No fuck given')
user_dir = setup_user_dir()
settings = get_settings(user_dir)
rules = get_rules(user_dir, settings)
matched_rule = get_matched_rule(command, rules, settings)
if matched_rule:
run_rule(matched_rule, command, settings)
else:
print('echo No fuck given')