Crates.io | preexec_confirm |
lib.rs | preexec_confirm |
version | 0.1.2 |
source | src |
created_at | 2022-04-10 10:26:42.497984 |
updated_at | 2022-04-10 10:47:34.421119 |
description | A zsh `middleware` forcing users to confirm before executing commands with preconfigured texts/regex patterns |
homepage | https://github.com/anhtumai/preexec_confirm |
repository | https://github.com/anhtumai/preexec_confirm |
max_upload_size | |
id | 565024 |
size | 240,920 |
A zsh `middleware` forcing user to confirm before executing commands
with preconfigured texts/regex patterns.
Users can define a YAML config file, specifying keywords or regex patterns
of dangerous commands that they don't want to execute by accident.
For example, serverless deploy --stage prod-environment
When the middleware detects a dangerous command, it will force the user to confirm by re-typing a random string, to avoid muscle memory.
Export env var SKIP_CONFIRM=true
if you want to temporarily ignore the middleware.
Requirements:
cargo install preexec_confirm
# ensure the system recognizes preexec_confirm path
which preexec_confirm
## ~/.cargo/bin/preexec_confirm
- contain: string
description (optional): string
regex (optional): bool
regex
optiontrue
, contain
will be treated as a regex pattern.zshrc
with correct orderfunction preexec_confirm_hook() {
CONFIG_PATH="/home/anhtumai/.config/confirm/config.yml" #change this
preexec_confirm $CONFIG_PATH $1
}
autoload -Uz add-zsh-hook
add-zsh-hook preexec preexec_confirm_hook
cargo uninstall preexec_confirm
.zshrc