可以建网站的软件,大连网站优化步骤,广告业网站开发,wordpress 自带的ajax目录 快速安装使用 . 1.简介 2.安装 3.配置 4.补充 官方盗料参考 快速安装使用
快速安装使用#xff0c;四步即可#xff1a;
#Ubuntu/Debian系统
sudo apt update
sudo apt install python3-dev python3-pip
sudo pip3 install thefuck
#编辑bashrc配置文件
vim ~/.bashrc…目录 快速安装使用 . 1.简介 2.安装 3.配置 4.补充 官方盗料参考 快速安装使用
快速安装使用四步即可
#Ubuntu/Debian系统
sudo apt update
sudo apt install python3-dev python3-pip
sudo pip3 install thefuck
#编辑bashrc配置文件
vim ~/.bashrc
#在文件尾加入一行给thefuck取别名fuck
eval $(thefuck --alias fuck)
#使生效
source ~/.bashrc#其他#
#修正三条命令前的错误 - fuck 3
#新到最新的 thefuck - sudo pip3 install thefuck --upgrade1. 简介
thefuck 是一个开源的命令行工具用于自动纠正终端中的错误命令。它通过分析最近执行的命令和错误信息提供一个或多个可能的正确命令用户可以选择自动执行或手动确认。 更多示例
➜ 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/↑/↓/ctrlc]
[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, usegit push --set-upstream origin master➜ fuck
git push --set-upstream origin master [enter/↑/↓/ctrlc]
Counting objects: 9, done.
...2. 安装
#CentOS系统
yum -y update yum -y install gcc
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py yum -y install python-devel
sudo -H pip install thefuck#Ubuntu/Debian系统
sudo apt update
sudo apt install python3-dev python3-pip
sudo pip3 install thefuck更多安装及使用方法查看Github项目地址https://github.com/nvbn/thefuck。
3.配置
#编辑bashrc配置文件
vim ~/.bashrc
#在文件尾加入一行给thefuck取别名fuck
eval $(thefuck --alias fuck)
#使生效
source ~/.bashrc最后使用fuck命令来纠正命令行拼写错误。
4. 补充 历史修正 #thefuck 可以使用历史记录来更正以前的命令。例如如果你想修正三条命令前的错误$ fuck 3更新到最新的 thefuck 的方法: sudo pip3 install thefuck --upgrade自定义部分配置示例 #thefuck的配置文件位于 ~/.config/thefuck/settings.py。你可以在这里修改一些默认设置例如
#这个参数指定了 thefuck 应用的规则列表。thefuck 会根据这些规则来修正命令错误。如果没有特别指定thefuck 会使用所有默认的规则
rules [list_of_rules]
require_confirmation True
wait_command 3#例如
rules [sudo, no_command, missing_argument] 表示只启用 sudo、no_command 和 missing_argument 这三个规则
#下列参数指定在修正命令之前是否需要用户确认。如果设置为 Truethefuck 会在执行修正命令之前提示用户确认。如果设置为 Falsethefuck 会自动修正并执行命令而不需要用户确认
require_confirmation True
#wait_command 3这个参数指定 thefuck 在执行修正命令之前等待的时间单位秒。这是为了给用户提供一个时间窗口来取消修正操作。如果你不需要这个延迟可以设置为 0
wait_command 0综上示例所述这些设置帮助你更灵活地控制 thefuck 的行为 rules [sudo, no_command, missing_argument]
require_confirmation True
wait_command 3编写自定义规则 可以编写自己的规则来处理特定的命令错误。在 ~/.config/thefuck/rules/ 目录中创建一个新的 Python 文件。 示例创建一个 git_no_branch.py 文件 from thefuck.utils import replace_argument, for_app
from thefuck.specific.git import git_supportgit_support
def match(command):return (error: src refspec master does not match any in command.output)
git_support
def get_new_command(command):return replace_argument(command.script, master, main)参考资料
GitHub - nvbn/thefuck: Magnificent app which corrects your previous console command.Thefuck - 华南理工大学科学计算公共服务平台用户手册
附上原文说明 Requirements python (3.5)pippython-dev Back to Contents Intallation On macOS or Linux, you can install The Fuck via Homebrew: brew install thefuckOn Ubuntu / Mint, install The Fuck with the following commands: sudo apt update
sudo apt install python3-dev python3-pip python3-setuptools
pip3 install thefuck --userOn FreeBSD, install The Fuck with the following commands: pkg install thefuckOn ChromeOS, install The Fuck using chromebrew with the following command: crew install thefuckOn Arch based systems, install The Fuck with the following command: sudo pacman -S thefuckOn other systems, install The Fuck by using :pip pip install thefuckAlternatively, you may use an OS package manager (OS X, Ubuntu, Arch). # It is recommended that you place this command in your , , or other startup script:.bash_profile.bashrc.zshrc eval $(thefuck --alias)
# You can use whatever you want as an alias, like for Mondays:
eval $(thefuck --alias FUCK)Or in your shell config (Bash, Zsh, Fish, Powershell, tcsh). Changes are only available in a new shell session. To make changes immediately available, run (or your shell config file like ).source ~/.bashrc.zshrc To run fixed commands without confirmation, use the option (or just for short, or if you’re especially frustrated):--yeah-y--hard fuck --yeahTo fix commands recursively until succeeding, use the option:-r fuck -rBack to Contents Updating pip3 install thefuck --upgradeNoe: Alias functionality was changed in v1.34 of *The Fuck* Uninstall To remove The Fuck, reverse the installation process: erase or comment thefuck alias line from your Bash, Zsh, Fish, Powershell, tcsh, … shell config Noe: Alias functionality was changed in v1.34 of *The Fuck* Uninstall To remove The Fuck, reverse the installation process: erase or comment thefuck alias line from your Bash, Zsh, Fish, Powershell, tcsh, … shell configuse your package manager (brew, pip3, pkg, crew, pip) to uninstall the binaries