Allow omitting argument patterns in rules/tasks/fallbacks in some cases.

Also clean up the code to remove a ton of duplication.
Fix the order of arguments passed to tasks.