Created
December 8, 2021 10:36
-
-
Save MAGANER/2e5f68071028e023cfb45886ecd15069 to your computer and use it in GitHub Desktop.
Little python script to generate .gitignore file for c++ projects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
_all = os.listdir(os.getcwd()) | |
files = list(filter(lambda n: os.path.isfile(n),_all)) | |
def is_cpp(file): | |
ext = [".cpp",".hpp",".h",".c"] | |
for e in ext: | |
if file.endswith(e): | |
return True | |
return False | |
not_cpp_stuff = list(filter(lambda n: not is_cpp(n),files)) | |
with open(".gitignore","w") as f: | |
for n in not_cpp_stuff: | |
f.write(n+"\n") | |
f.write(".vs/") #for visual studio stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment