Skip to content

Add 'Are you sure?' support for your existing shell interactive commands.

License

Notifications You must be signed in to change notification settings

xuzhongping/rusure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Add 'Are you sure?' support for your shell interactive commands.

Installation

zsh

oh-my-zsh

  • 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)
    

Usage

  • 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 ~

Supported

  • zsh
  • other shell

Author

👤 nakahira

Thanks

Show your support

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!

About

Add 'Are you sure?' support for your existing shell interactive commands.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages