jsonresume/resume-cli — pull request #50 by djengineerllc (2014-08-13 02:53:46+00:00)
Title: New Options (localhost bind, specify resume file path, specify output directory)

Hello everyone,

I have made some modifications to this cool code. I have updated this for a custom joomla module I am working on to build resume pages, etc.

Updates:

1.) Option to bind server to localhost only (-l, --local)
I never like binding the server to a port when viewing pages. Mainly because it opens a server port and leaves my server less secure. So I added the -l option to specify only to bind to localhost. Then I can just specify a subdirectory and proxy with apache, and then I'm able to server the resume to a sub directory of the domain and there's no exposed ports.
Example: "resume -l -p 2020 serve"

2.) Option to specify the location and name of your resume json file (-r, --resume)
Instead of having to place the json file in the same directory, it may be necessary to have special locations for the resume files for security purposes. With the -r option, you can simply pass in the path and you no longer have to have the file named resume.json and it no longer has to be in the same running directory.
Example: "resume -r /var/www/html/Apps/270/JohnnysResume.json export"

3.) Option to specify the export output directory when exporting an HTML or PDF file (-d, --exportDir)
Now, your files do not all have to end up in the same spot. You can place them where a directory exists on your server (given that you have your permissions setup correctly of course).
Example: "resume -f pdf -r /var/www/html/Apps/270/JohnnysResume.json -d /var/www/html/Apps/270/files/ export MyPDFResume"

4.) Last but not least: the help information, seen when running the command 'resume -h', defines the usage of the resume cli script to be used as follows: "resume [options] [command]". I updated parts of the code that were checking the command at position 2 of the arguments into the resume cli script. Well, if you have a bunch of options specified, the command would no longer be at position 2. I have updated the script so that instead of position 2, it is now at position (number of arguments - 1). This will now set everything up correctly so that the command is always found no matter how many options are specified. That said, you must specify the command at the end as the help information says!! Also, there is 1 command (the export command) that also takes a filename afterwards. So there is one spot in the code in which I had to check for the command either at the last argument position (number of arguments -1) or the 2nd to last argument position (number of arguments -2).

NOTES: Feel free to not update the code if you don't want to, or make any modifications deemed necessary (like if you want to beautify the code up a little, or whatever, lol). I was just making some updates for my custom joomla component in which I needed the script to be a little more flexible for security reasons. :+1:

Also, sorry for my stupid comments, and my stages of code debugging and code debugging removal w/in the code. Not sure if that all gets recorded in the commit history or not, but it probably does. If you need to rewrite history to keep everything clean, I don't mind at all.