I dropped the $name argument from my previous version here, in favour of reusing the command's name, for the sake of simplicity.