docs: tighten mtm-ddwipe help and project guidance

This commit is contained in:
2026-04-27 23:05:22 +02:00
parent 7321d7e087
commit 08d6ccde0d
2 changed files with 26 additions and 10 deletions
+2 -1
View File
@@ -16,8 +16,9 @@ description: mtm-ddwipe project conventions
- Keep the host and line-number removal behavior intact.
- `mtm-ddwipe` must print a usage line and support `-h`/`--help`.
- Validate that wipe targets are real block devices before operating on them.
- Prefer explicit, short confirmation prompts before destructive operations.
- Keep short, explicit confirmation prompts before destructive operations.
- Keep error and help messages short, clear, and in English.
- Keep help text concise and usage-first.
# Project identity
- Main script: `mtm-ddwipe`
+20 -5
View File
@@ -5,21 +5,35 @@ declare STARTDATE=""
declare STARTDATESTRING=""
show_help() {
echo "ddwipe dev (/dev/sdX)"
echo "Usage: mtm-ddwipe DEVICE"
echo ""
echo "Wipe a block device."
echo "Version: 0.0.3"
}
check_args() {
if [ "${1}" == "" ]; then
case "${1}" in
-h|--help)
show_help
exit 0
;;
"")
show_help
exit 1
fi
;;
esac
}
check_dev_exist() {
if [ ! -e "${1}" ]; then
echo "${1} is missing."
echo "Missing device."
exit 1
fi
}
check_dev_block() {
if [ ! -b "${1}" ]; then
echo "Not a block device."
exit 1
fi
}
@@ -63,7 +77,7 @@ wipe_dev() {
fi
fi
echo ""
echo "Device ${1} wipped !"
echo "Device ${1} wiped."
}
print_time() {
@@ -84,6 +98,7 @@ print_time() {
check_args "${DEV}"
check_dev_exist "${DEV}"
check_dev_block "${DEV}"
confirm_wipe "${DEV}"
wipe_dev "${DEV}"
print_time