# python.snippets
# vim: set ts=8 sw=8 sts=8 noet list:
# Eryn Wells <eryn@erynwells.me>

snippet parse_args
	def parse_args():
		parser = argparse.ArgumentParser()
		# TODO: Configure arguments here.
		args = parser.parse_args()
		return args

snippet ifmain
	def main():
		${1:pass}
	
	if __name__ == '__main__':
		main()

snippet script
	#!/usr/bin/env python3
	# `g:snips_author`

	'''
	New script.
	'''

	import argparse

	def parse_args(argv, *a, **kw):
		parser = argparse.ArgumentParser(*a, **kw)
		# TODO: Configure arguments here.
		args = parser.parse_args(argv)
		return args
	
	def main(argv):
		args = parse_args(argv[1:], prog=argv[0])
		${1:# TODO}
	
	if __name__ == '__main__':
		import sys
		result = main(sys.argv)
		sys.exit(0 if not result else result)
