Move scripts' arg parsing to scripts/

Also add rudimentary tests for them.