I want to add a flag to alias, in my case I want do it for bat. e.g.
mybat -a = 'bat --paging=always [file e.g .zshrc]'
mybat -n = 'bat --paging=never [file e.g .zshrc] '
I also wrote and tested the following code, but it did not work:
mybat() {
local OPTIND value
while getopts ":an" option; do
case $option in
a) value=never ;;
n) value=always ;;
?) echo "invalid option: $OPTARG"; return 1 ;;
esac
done
bat --paging=$value
}
Anyone have an idea?