#!/usr/bin/env python3

import argparse
from cpgclient.CpgClient import CpgClient


class CpgCreate:

    def main(self):
        """
        Parse command line and issue command to create CPG
        """

        args = self._parse_command_line()
        self.create(args.directory)

    def _parse_command_line(self):
        parser = argparse.ArgumentParser(description='Instruct server to create and load a CPG')
        parser.add_argument('directory', type=str,
                            help='directory containing C/C++ code')
        return parser.parse_args()

    def create(self, directory):
        """
        Issue command to create CPG for `directory`
        """
        client = CpgClient()
        client.create_cpg(directory)


if __name__ == '__main__':
    CpgCreate().main()
