mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-11-04 00:52:04 +00:00 
			
		
		
		
	Compare commits
	
		
			9 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					0fc7c00e8d | ||
| 
						 | 
					64318c09b7 | ||
| 
						 | 
					5b6e17b5f1 | ||
| 
						 | 
					6cdc2c27fb | ||
| 
						 | 
					62c605d0ac | ||
| 
						 | 
					8930d01601 | ||
| 
						 | 
					c749615ad6 | ||
| 
						 | 
					f03d8c54b1 | ||
| 
						 | 
					20f1c76d27 | 
							
								
								
									
										13
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
									
									
									
									
								
							@@ -73,7 +73,7 @@ REPL-y 0.3.1
 | 
			
		||||
...
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If you are scared to blindly run changed command, there's `require_confirmation`
 | 
			
		||||
If you are scared to blindly run the changed command, there is a `require_confirmation`
 | 
			
		||||
[settings](#settings) option:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
@@ -104,7 +104,7 @@ sudo pip install thefuck
 | 
			
		||||
 | 
			
		||||
[Or using an OS package manager (OS X, Ubuntu, Arch).](https://github.com/nvbn/thefuck/wiki/Installation)
 | 
			
		||||
 | 
			
		||||
And add to `.bashrc` or `.bash_profile`(for OSX):
 | 
			
		||||
And add to the `.bashrc` or `.bash_profile`(for OSX):
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
alias fuck='eval $(thefuck $(fc -ln -1)); history -r'
 | 
			
		||||
@@ -137,10 +137,11 @@ sudo pip install thefuck --upgrade
 | 
			
		||||
 | 
			
		||||
## How it works
 | 
			
		||||
 | 
			
		||||
The Fuck tries to match rule for the previous command, create new command
 | 
			
		||||
using matched rule and run it. Rules enabled by default:
 | 
			
		||||
The Fuck tries to match a rule for the previous command, creates a new command
 | 
			
		||||
using the matched rule and runs it. Rules enabled by default are as follows:
 | 
			
		||||
 | 
			
		||||
* `brew_unknown_command` – fixes wrong brew commands, for example `brew docto/brew doctor`;
 | 
			
		||||
* `cpp11` – add missing `-std=c++11` to `g++` or `clang++`;
 | 
			
		||||
* `cd_parent` – changes `cd..` to `cd ..`;
 | 
			
		||||
* `cd_mkdir` – creates directories before cd'ing into them;
 | 
			
		||||
* `cp_omitting_directory` – adds `-a` when you `cp` directory;
 | 
			
		||||
@@ -211,10 +212,10 @@ priority = 1000  # Lower first
 | 
			
		||||
 | 
			
		||||
## Settings
 | 
			
		||||
 | 
			
		||||
The Fuck has a few settings parameters, they can be changed in `~/.thefuck/settings.py`:
 | 
			
		||||
The Fuck has a few settings parameters which can be changed in `~/.thefuck/settings.py`:
 | 
			
		||||
 | 
			
		||||
* `rules` – list of enabled rules, by default `thefuck.conf.DEFAULT_RULES`;
 | 
			
		||||
* `require_confirmation` – require confirmation before running new command, by default `False`;
 | 
			
		||||
* `require_confirmation` – requires confirmation before running new command, by default `False`;
 | 
			
		||||
* `wait_command` – max amount of time in seconds for getting previous command output;
 | 
			
		||||
* `no_colors` – disable colored output;
 | 
			
		||||
* `priority` – dict with rules priorities, rule with lower `priority` will be matched first.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
from setuptools import setup, find_packages
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
VERSION = '1.39'
 | 
			
		||||
VERSION = '1.40'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
setup(name='thefuck',
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								thefuck/rules/cpp11.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								thefuck/rules/cpp11.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
def match(command, settings):
 | 
			
		||||
    return (('g++' in command.script or 'clang++' in command.script) and
 | 
			
		||||
            ('This file requires compiler and library support for the '
 | 
			
		||||
             'ISO C++ 2011 standard.' in command.stderr or
 | 
			
		||||
             '-Wc++11-extensions' in command.stderr))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_new_command(command, settings):
 | 
			
		||||
    return command.script + ' -std=c++11'
 | 
			
		||||
@@ -98,7 +98,10 @@ shells = defaultdict(lambda: Generic(), {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def _get_shell():
 | 
			
		||||
    shell = Process(os.getpid()).parent().cmdline()[0]
 | 
			
		||||
    try:
 | 
			
		||||
        shell = Process(os.getpid()).parent().cmdline()[0]
 | 
			
		||||
    except TypeError:
 | 
			
		||||
        shell = Process(os.getpid()).parent.cmdline[0]
 | 
			
		||||
    return shells[shell]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user