mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-30 14:44:05 +00:00
#682: Use system temporary directory
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
from tempfile import gettempdir
|
||||
from uuid import uuid4
|
||||
from ..conf import settings
|
||||
from ..const import ARGUMENT_PLACEHOLDER, USER_COMMAND_MARK
|
||||
@@ -38,13 +39,15 @@ class Bash(Generic):
|
||||
'''.format(user_command_mark=mark,
|
||||
app_alias=self.app_alias(alias_name))
|
||||
else:
|
||||
log_path = os.path.join(
|
||||
gettempdir(), 'thefuck-script-log-{}'.format(uuid4().hex))
|
||||
return '''
|
||||
export THEFUCK_INSTANT_MODE=True;
|
||||
export THEFUCK_OUTPUT_LOG={log};
|
||||
script -feq {log};
|
||||
rm {log};
|
||||
exit
|
||||
'''.format(log='/tmp/thefuck-script-log-{}'.format(uuid4().hex))
|
||||
'''.format(log=log_path)
|
||||
|
||||
def _parse_alias(self, alias):
|
||||
name, value = alias.replace('alias ', '', 1).split('=', 1)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from time import time
|
||||
import os
|
||||
from tempfile import gettempdir
|
||||
from uuid import uuid4
|
||||
from ..conf import settings
|
||||
from ..const import ARGUMENT_PLACEHOLDER, USER_COMMAND_MARK
|
||||
@@ -36,13 +37,15 @@ class Zsh(Generic):
|
||||
'''.format(user_command_mark=USER_COMMAND_MARK,
|
||||
app_alias=self.app_alias(alias_name))
|
||||
else:
|
||||
log_path = os.path.join(
|
||||
gettempdir(), 'thefuck-script-log-{}'.format(uuid4().hex))
|
||||
return '''
|
||||
export THEFUCK_INSTANT_MODE=True;
|
||||
export THEFUCK_OUTPUT_LOG={log};
|
||||
script -feq {log};
|
||||
rm {log};
|
||||
exit
|
||||
'''.format(log='/tmp/thefuck-script-log-{}'.format(uuid4().hex))
|
||||
'''.format(log=log_path)
|
||||
|
||||
def _parse_alias(self, alias):
|
||||
name, value = alias.split('=', 1)
|
||||
|
||||
Reference in New Issue
Block a user