Initial commit
commit
5628942b4f
|
@ -0,0 +1,11 @@
|
|||
# gitignore
|
||||
|
||||
Quick and dirty way to generate a gitignore file.
|
||||
Usage:
|
||||
`gitignore <langagues/frameworks/editors>`
|
||||
|
||||
You can either comma-separate this or space-separate this. You will be asked to save the file (to .gitignore in the current folder) or just view it.
|
||||
|
||||
I recommend viewing it first and double checking if it's all good before running it again and saving.
|
||||
|
||||
It includes gitignore values for Vim by default as this is the default editor I use. For CMake projects it also includes the folder `build/` as this is standard for my programming, and is not included by default from gitignore.io.
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
from sys import argv
|
||||
|
||||
GITIGNORE_BASE_URL = "https://www.toptal.com/developers/gitignore/api/vim"
|
||||
|
||||
def main() -> int:
|
||||
FINAL_URL: str = GITIGNORE_BASE_URL
|
||||
gitignore: str = ""
|
||||
for arg in argv[1:]:
|
||||
FINAL_URL += f",{arg.lower()}"
|
||||
res: requests.Response = requests.get(FINAL_URL)
|
||||
to_save: str = input("Gitignore file has been generated. Save? (Y/n) ")
|
||||
gitignore: str = res.text
|
||||
if "cmake" in argv:
|
||||
gitignore += "\nbuild/"
|
||||
if to_save.lower() == "y" or to_save == "" or to_save == "yes":
|
||||
save_file(gitignore)
|
||||
else:
|
||||
print(gitignore)
|
||||
return 0
|
||||
|
||||
def save_file(contents: str) -> None:
|
||||
with open("./.gitignore", "w") as g:
|
||||
g.write(contents)
|
||||
print("Wrote contents to `.gitignore`.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
Loading…
Reference in New Issue