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": [ "words": [
"Everbridge", "Everbridge",
"ITS's", "ITS's",
"PHONENUMBER",
"alacritty", "alacritty",
"angulo",
"crkbd", "crkbd",
"dotfiles", "dotfiles",
"hardcode",
"homelab", "homelab",
"latexmk",
"toolset" "toolset"
], ],
"flagWords": [] "flagWords": []

View file

@ -10,9 +10,23 @@ flake to build a resume generator command.
Use the flake! Use the flake!
```bash ```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 hardcode those in my tex file. Hopefully this helps prevent spammers from
finding my personal contact information. finding my personal contact information.

View file

@ -61,7 +61,7 @@
\fancyfoot[L]{ \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{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}\\ \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} \vspace*{0.175in}
\hspace*{-2em} \hspace*{-2em}

View file

@ -44,10 +44,27 @@
RES=$(pwd)/alejandro_resume.pdf RES=$(pwd)/alejandro_resume.pdf
LOG=$(pwd)/alejandro_resume.log 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 case $flag in
'd') DEBUG=true;; '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 esac
done done