mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 12:28:41 +00:00
Add initial tcsh support. Still require better history support
This commit is contained in:
parent
a83d75991b
commit
7b29b54ac7
@ -118,6 +118,11 @@ Or in your `.zshrc`:
|
|||||||
alias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R'
|
alias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you are using `tcsh`:
|
||||||
|
```tcsh
|
||||||
|
alias fuck 'set fuckedCmd=`history -h 2 | head -n 1` && eval `thefuck ${fuckedCmd}`'
|
||||||
|
```
|
||||||
|
|
||||||
Alternatively, you can redirect the output of `thefuck-alias`:
|
Alternatively, you can redirect the output of `thefuck-alias`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -92,9 +92,34 @@ class Zsh(Generic):
|
|||||||
return u': {}:0;{}\n'.format(int(time()), command_script)
|
return u': {}:0;{}\n'.format(int(time()), command_script)
|
||||||
|
|
||||||
|
|
||||||
|
class Tcsh(Generic):
|
||||||
|
def app_alias(self):
|
||||||
|
return "\nalias fuck 'set fucked_cmd=`history -h 2 | head -n 1` && eval `thefuck ${fucked_cmd}`'\n"
|
||||||
|
|
||||||
|
def _parse_alias(self, alias):
|
||||||
|
name, value = alias.split("\t", 1)
|
||||||
|
return name, value
|
||||||
|
|
||||||
|
def _get_aliases(self):
|
||||||
|
proc = Popen('tcsh -ic alias', stdout=PIPE, stderr=DEVNULL, shell=True)
|
||||||
|
return dict(
|
||||||
|
self._parse_alias(alias)
|
||||||
|
for alias in proc.stdout.read().decode('utf-8').split('\n')
|
||||||
|
if alias and '\t' in alias)
|
||||||
|
|
||||||
|
def _get_history_file_name(self):
|
||||||
|
return os.environ.get("HISTFILE",
|
||||||
|
os.path.expanduser('~/.history'))
|
||||||
|
|
||||||
|
def _get_history_line(self, command_script):
|
||||||
|
return u'#+{}\n{}\n'.format(int(time()), command_script)
|
||||||
|
|
||||||
|
|
||||||
shells = defaultdict(lambda: Generic(), {
|
shells = defaultdict(lambda: Generic(), {
|
||||||
'bash': Bash(),
|
'bash': Bash(),
|
||||||
'zsh': Zsh()})
|
'zsh': Zsh(),
|
||||||
|
'-csh': Tcsh(),
|
||||||
|
'tcsh': Tcsh()})
|
||||||
|
|
||||||
|
|
||||||
def _get_shell():
|
def _get_shell():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user