Makes files with content from your Templates directory.
template index.html
# makes a file called "index.html" based on the template file "html.html"
```| #!/usr/bin/env python3 | |
| import sys | |
| import getpass | |
| templates_dir = "/home/{user}/Templates/".format( user=getpass.getuser() ) | |
| arg = sys.argv[1] | |
| output_filename = sys.argv[1] | |
| input_fileext = arg[arg.rfind(".")+1:] | |
| input_filename = input_fileext + "." + input_fileext | |
| if input_filename: | |
| input_content = open(templates_dir + input_filename).read() | |
| output_file = open(output_filename, "w") | |
| output_file.write(input_content) | |
| output_file.close() | |
| else: | |
| print("i confuse ;_;") |