areyousure
is a command-line utility that can be used to intercept
sensitive commands and ask the user whether they are sure about executing them.
This can save your bacon when accidentally doing a git push -f
on the wrong branch
or a kubectl delete namespace production
.
$ kubectl delete namespace somenamespace
😮 DANGER. You are about to execute:
👉 kubectl delete namespace somenamespace
🤔 Are you sure? [Yy] n
👍 Stopping
$ kubectl delete namespace somenamespace
😮 DANGER. You are about to execute:
👉 kubectl delete namespace somenamespace
🤔 Are you sure? [Yy] y
namespace "somenamespace" deleted
Suppose you want to intercept all kubectl delete
commands, add the following to your
~/.zshrc
/ ~/.bashrc
or similar:
kubectl() {
if [[ "$@" =~ "delete" ]]; then
command areyousure "$0" "$@"
else
command kubectl "$@"
fi
}
You probably know what you're doing if you're using another shell.
Grab the latest build from the releases section, or follow the build instructions below.
You will need cmake, make and a C compiler for this. On a Debian-based distro something like this is like going to work:
apt install cmake make gcc
mkdir build
cd build
cmake ..
make
sudo make install # Will copy to /usr/local/bin
- Timer (i.e. will execute in 5s)
--install
which builds a shell script to wrap command (areyousure --install kubectl delete
)- Config options / file (i.e. whether to use emojis)
- Automatic build in GitHub
- Pre-defined list of sensitive commands that can be auto-installed