Added additional params and added usage

This commit is contained in:
Alejandro Angulo 2022-12-20 09:40:52 -08:00
parent 0aed99b97e
commit e3bd8f932d
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
4 changed files with 40 additions and 5 deletions

View file

@ -4,10 +4,14 @@
"words": [
"Everbridge",
"ITS's",
"PHONENUMBER",
"alacritty",
"angulo",
"crkbd",
"dotfiles",
"hardcode",
"homelab",
"latexmk",
"toolset"
],
"flagWords": []

View file

@ -10,9 +10,23 @@ flake to build a resume generator command.
Use the flake!
```bash
env EMAIL='foo@bar.com' PHONENUMBER='(555) 555-5555' nix run github:alejandro-angulo/resume
nix run github:alejandro-angulo/resume -- -h
Usage: alejandro-resume [-h] [-d] [-e EMAIL] [-p PHONENUMBER]
-h Prints this usage message.
-d Saves latexmk log file (will be named alejandro_resume.log)
-e EMAIL Sets email address used when building document.
Can also be set with EMAIL environment variable.
-p PHONENUMBER Sets phone number used when building the document.
Can also be set with PHONENUMBER environment variable.
nix run github:alejandro-angulo/resume -- -e 'foo@bar.com' -p '(555) 555-5555'
```
The `EMAIL` and `PHONENUMBER` variables are required because I didn't want to
The email and phone number parameters are required because I didn't want to
hardcode those in my tex file. Hopefully this helps prevent spammers from
finding my personal contact information.

View file

@ -61,7 +61,7 @@
\fancyfoot[L]{
\small{The source code for this document is available at \href{https://github.com/alejandro-angulo/resume}{https://github.com/alejandro-angulo/resume}}\\
\small{If you have \href{https://nixos.wiki/wiki/Nix_package_manager}{nix} installed you can run the command below to generate the latest version of this document}\\
\scriptsize{\texttt{env EMAIL='\email' PHONENUMBER='\phonenumber' nix run --refresh --experimental-features 'nix-command flakes' github:alejandro-angulo/resume/main}}
\scriptsize{\texttt{nix run --refresh --experimental-features 'nix-command flakes' github:alejandro-angulo/resume/main -- -e '\email' -p '\phonenumber'}}
}
\vspace*{0.175in}
\hspace*{-2em}

View file

@ -44,10 +44,27 @@
RES=$(pwd)/alejandro_resume.pdf
LOG=$(pwd)/alejandro_resume.log
while getopts 'd' flag; do
function usage {
echo "Usage: $(basename $0) [-h] [-d] [-e EMAIL] [-p PHONENUMBER]"
echo ' -h Prints this usage message.'
echo ""
echo ' -d Saves latexmk log file (will be named alejandro_resume.log)'
echo ""
echo ' -e EMAIL Sets email address used when building document.'
echo ' Can also be set with EMAIL environment variable.'
echo ""
echo ' -p PHONENUMBER Sets phone number used when building the document.'
echo ' Can also be set with PHONENUMBER environment variable.'
}
while getopts ':de:p:h' flag; do
case $flag in
'd') DEBUG=true;;
*) echo 'TODO: Add usage';;
# Overrides EMAIL and PHONENUMBER envvars if set
'e') EMAIL="$OPTARG";;
'p') PHONENUMBER="$OPTARG";;
'h') usage && exit;;
?) usage && exit 1;;
esac
done