mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 20:38:54 +00:00
#682: Use system temporary directory
This commit is contained in:
parent
84f6d2631e
commit
50dd4b8f54
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user