Add 'Are you sure?' support for your shell interactive commands.
-
Clone the repository inside your oh-my-zsh repo:
git clone https://github.com/xuzhongping/rusure.git ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/rusure
-
Activate the plugin in ~/.zshrc:
plugins=(… rusure)
-
Set the commands you need to prompt in the configuration file:
${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/rusure/zsh/config.yml
cmds: - rm -rf ~ - git checkout . # - other cmd # You can customize your prompt text. ask: Are you sure? yes: Y no: N
-
When you enter a command and press the Enter key, if it hits the setting, it will automatically add a pre-command to your command:
> rm -rf ~
after typing enter:
> rusure_exec rm -rf ~ Are you sure?(Y/N):
-
If you type in any combination of uppercase and lowercase of Y or YES, the original command will start to execute, otherwise it will be cancelled.
> rusure_exec rm -rf ~ Are you sure?(Y/N):N Cancelled!
-
Of course, you can also explicitly type a pre-command to execute it:
> rusure rm -rf ~
- zsh
- other shell
👤 nakahira
- Website: nakahira.cn
- Github: @xuzhongping
Give a ⭐️ if this project helped you!
Currently we will only support zsh, and we hope it can be used in other shells too. If you can help, we are very welcome!