Refactor: tools: Make more things in crm_resource into functions.
Basically, anything halfway complicated in the main function that's not related to just processing command line arguments is now its own function.