From c749615ad6184976e2bbdf537209a446e01c7eab Mon Sep 17 00:00:00 2001 From: mcarton Date: Sat, 9 May 2015 20:37:13 +0200 Subject: [PATCH 1/2] Add a `C++11` rule --- thefuck/rules/c++11.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 thefuck/rules/c++11.py diff --git a/thefuck/rules/c++11.py b/thefuck/rules/c++11.py new file mode 100644 index 00000000..f4d8ab5a --- /dev/null +++ b/thefuck/rules/c++11.py @@ -0,0 +1,11 @@ +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' From 8930d0160128bc224e6857d03b0775bf1c8d4de1 Mon Sep 17 00:00:00 2001 From: mcarton Date: Sat, 9 May 2015 20:42:18 +0200 Subject: [PATCH 2/2] Update README.md to add the C++11 rule --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e903d76b..f173283a 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,7 @@ The Fuck tries to match rule for the previous command, create new command using matched rule and run it. Rules enabled by default: * `brew_unknown_command` – fixes wrong brew commands, for example `brew docto/brew doctor`; +* `c++11` – 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;