Skip to content

Instantly share code, notes, and snippets.

@rkben
Created June 8, 2021 21:10
Show Gist options
  • Save rkben/d190103c29798dedcea7211792d61dc0 to your computer and use it in GitHub Desktop.
Save rkben/d190103c29798dedcea7211792d61dc0 to your computer and use it in GitHub Desktop.
import sys
import argparse
parser = argparse.ArgumentParser(description="Generate a cover letter, use {company} and {position} in place where you want each to be")
parser.add_argument("-c", "--company", help="Name of company", type=str)
parser.add_argument("-p", "--position", help="Position at company", type=str)
parser.add_argument("-f", "--file", help="File to format, plain text", type=str)
args = parser.parse_args()
if __name__ == "__main__":
if not args.position or not args.company:
parser.print_help()
elif not args.file:
letter = """I am NAME applying for the {position} position. I can bring alot to {company}. Also this is an example"""
print(letter.format(position=args.position, company=args.company))
else:
import pathlib
if pathlib.Path(args.file).exists():
text = pathlib.Path(args.file).read_text()
print(text.format(position=args.position, company=args.company))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment