#!/usr/bin/env python3
# Copyright (c) 2022 Arista Networks, Inc.  All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.

"""
A python script to read a python file and get docstring from it after
parsing the file using ast. This script will be invoked with python2
and python3 as needed.
"""

import ast
import sys

def main():
   pathToFile = sys.argv[ 1 ]
   with open( pathToFile ) as f:
      buf = f.read()
   print( ast.get_docstring( ast.parse( buf, filename=pathToFile ) ) )

if __name__ == "__main__":
   main()
