Mathew Ostrander: Software Developer by day, Gamer by night, and Adventurer on the weekends. Mobile and Front-End Developer with Node.js training. Currently increasing Back-End capabilites by learning C#
Try it out at the Github Repository.
This is an exercise recreating the command line app ‘cal’ written as a Node.js module.
This was also a lesson in Test Driven Development. Mocha and Chai were used in conjuction with Travis CI for distributed testing & Coveralls for test coverage.
Since it’s a command line app, you will need access to your terminal. You will also need Git and NPM
- In the directory you want to install, Git Clone this repo
- Change Directory into the cloned repo
- In that main directory run
- To be able to run the file directly type
chmod +x cal.js
To run the app, simply type ./cal.js in the main directory of the cloned repo To run it in other locations you will need to type the full path to the file.
./cal.js with no arguments displays the current month’s calendar in the console
./cal.js <year> with a four digit year between 1753 and 9999 (inclusive) will display a full calendar year
If the year chosen is outside the range or illegible
./cal.js <month> <year> with a valid year and month will display that particular month and year. 1753 and 9999 (inclusive) will display a full calendar year.
A valid month must either be a number between 1-12 inclusive, the full month name, or a three letter abreviation of a month name.