import project
import csv

def to_csv(trello_json_path, project_csv_path):
  table = project.get_project(trello_json_path).to_table()
  with open(project_csv_path, 'wb') as project_csv:
    writer = csv.writer(project_csv)
    for row in table:
      writer.writerow(row)

if __name__ == '__main__':
  import argparse
  parser = argparse.ArgumentParser(description='Convert Trello JSON to CSV.')
  parser.add_argument('trello_json_path', type=str, help='the Trello JSON')
  parser.add_argument('project_csv_path', type=str, help='the CSV')
  args = parser.parse_args()
  to_csv(args.trello_json_path, args.project_csv_path)