'''
Python script for counting the number of rows in a Twarc-hydrated CSV file, excluding the header row
'''
import argparse
import csv

def getArgs():
	argparser = argparse.ArgumentParser(description="Count the number of records in a Twarc-hydrated CSV file, excluding the header row")
	argparser.add_argument("inputFile", help="CSV file")
	args = argparser.parse_args()
	return args

def main():
	args = getArgs()
	
	with open(args.inputFile, encoding='utf-8') as csvfile:
		readCSV = csv.reader(csvfile, delimiter=',')
		rowCount = sum(1 for row in readCSV)
		print(rowCount - 1)

if __name__ == "__main__":
	main()
