script ready for a patch
curl -LO https://raw.githubusercontent.com/camphi/ready-to-patch/refs/heads/master/patch.sh && git diff >> patch.sh
mkpatch() {
if [[ -t 0 || "$1" == "-?" || "$1" == "-h" || "$1" == "--help" ]]
then
echo 'Usage: git diff | mkpatch {patch-name.sh}'
return
fi
if [[ -e "$1" ]]; then
echo "Error: $1 already exists."
return 1
fi
patch_name=${1:-"patch_"$(date -Iminutes)".sh"}
curl -Lo "$patch_name" https://raw.githubusercontent.com/camphi/ready-to-patch/refs/heads/master/patch.sh &>/dev/null
cat - >> "$patch_name"
echo "$patch_name"
}