Skip to content

Commit

Permalink
Merge pull request #1 from hastagAB/HastagAB/Developement
Browse files Browse the repository at this point in the history
feat(extractor): add language indentifier
  • Loading branch information
hastagAB committed May 23, 2020
2 parents 58348ad + e54deab commit a585aea
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# VSCode
.vscode
50 changes: 50 additions & 0 deletions extractor/extractor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import argparse


class CommentExtractor:
def __init__(self):
pass

def langIdentifier(self, file):
extension = os.path.splitext(file)[1]


langMap = {
'.py': 'python',
'.c': 'c',
'.cs': 'c#',
'.cpp': 'c++',
'.css': 'css',
'.go': 'go',
'.hs': 'haskell',
'.html': 'html',
'.java': 'java',
'.js': 'javascript',
'.kt': 'kotlin',
'.kts': 'kotlin',
'.ktm': 'kotlin',
'.m': 'matlab',
'.php': 'php',
'.pl': 'perl',
'.r': 'r',
'.rbb': 'ruby',
'.rs': 'rust',
'.sh': 'shell',
'.swift': 'swift',
'.scala': 'scala',
'.sc': 'scala',
}

return langMap[extension]


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("inputFile", help="Specify the input file path to scan")

args = parser.parse_args()
file = args.inputFile

0 comments on commit a585aea

Please sign in to comment.