大数跨境

奇葩Python软件--The Fuck

奇葩Python软件--The Fuck Python程序员
2016-01-07
0
导读:程序员最容易发脾气了, 就算是Linus这样的大神也不例外. 键盘那么小, 手一抖就敲错了, fuck...



程序员最容易发脾气了, 就算是Linus这样的大神也不例外. 键盘那么小, 手一抖就敲错了, fuck.....(这句话是多么地自然而然)


要是自然而然之余, 还能把敲错的命令, 纠正过来, 那简直就是.......完美!


好吧, 已经有一个Python软件实现了这么完美的功能了. 那就是: The Fuck.

让我们先感受一下这款软件的作用:


是不是感受到了自己的系统前所未有地听话? 赞!


那么如何安装它?



如果你的电脑是Mac或者Ubuntu, 可以直接执行这条命令

wget -O - https://raw.githubusercontent.com/nvbn/thefuck/master/install.sh | sh - && $0


如果你是其他的操作系统, 先使用pip安装

sudo pip install thefuck

然后再将下面三行加入到你的shell启动脚本中

eval "$(thefuck --alias)"
# You can use whatever you want as an alias, like for Mondays:eval "
$(thefuck --alias FUCK)"

根据你的系统的不同, 启动脚本的名字可能叫 .bash_profile 或者 .bashrc或者.zshrc

然后关闭终端, 重新打开, The Fuck就可以使用了.


下面还有一些其他的使用The Fuck的例子:



➜ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?➜ fuck
sudo apt-get install vim [enter/↑/↓/ctrl+c]
[sudo] password for nvbn:
Reading package lists... Done
...


➜ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master


➜ fuck
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 9, done.
...


➜ puthon
No command 'puthon' found, did you mean:
 Command 'python' from package 'python-minimal' (main)
 Command 'python' from package 'python3' (main)
zsh: command not found: puthon

➜ fuck
python [enter/↑/↓/ctrl+c]
Python 3.4.2 (default, Oct  8 2014, 13:08:17)...


➜ git brnch
git: 'brnch' is not a git command. See 'git --help'.

Did you mean this?
    branch

➜ fuckgit branch [enter/↑/↓/ctrl+c]* master


➜ lein rpl'rpl' is not a task. See 'lein help'.

Did you mean this?
         repl

➜ fuck
lein repl [enter/↑/↓/ctrl+c]
nREPL server started on port 54848 on host 127.0.0.1 - nrepl://127.0.0.1:54848
REPL-y 0.3.1...


更完整的列表以及项目介绍在github上:

https://github.com/nvbn/thefuck?r=1

【声明】内容源于网络
0
0
Python程序员
1234
内容 2525
粉丝 0
Python程序员 1234
总阅读0
粉丝0
内容2.5k