DEV Community

Ray
Ray

Posted on

Link Checker Release v0.1

Every once in a while I wake up in a cold sweat. My brain is moving faster than I can recognize it. One thought comes to the forefront:

I can't figure out if all the links in the big long list of links on my desktop actually work without testing them one by one

That's when I realized, the assignment I was given the second week of OSD600 was created to rectify this very problem.

Enter: Link Checker.

I'll explain the process in a moment but first let me describe what Link Checker is and what it does. Link checker is a node script that allow the user to specify a file, extracts the links from that file, and tests them to find if they are good or bad links.

All Good! Kinda?

Simple, right? Pretty much.

To use, all you have to go is clone the git repo, go into your node cli, and call the script by specifying the file you'd like to check.

node index.js ../files/test.txt

More information is available on my git repo for the app.

GitHub logo fluentinstroll / Link-Checker

An app to let people check URLs and find out if they actually work!

Link-Checker

An app to let people check URLs and find out if they actually work!

This app uses node, therefore you need to have the latest version of node installed on your computer.

Features included

  • Colourizing output. Good URLs should be printed in green, bad URLs in red, and unknown URLs in gray
  • Running the tool with the v or version argument should print the name of the tool and its version
  • Supports both --version and -v command line arguments
  • Use the -g and -b arguments after you enter the filename in order to only print good or bad links!
  • The app will also let you know what your exit code is after it's finished (0 for only good links, 1 for at least 1 bad link, and 2 for at least 1 unknown link)
  • Use the -i argument to ignore certain links in a file!

To use:

Needed to

You might have an html file, a pile of links within, and you want to know if the links actually work. Link Checker does it easily. It even colour-codes the links and tells you if they're good or bad.

Another feature is simple, but if you enter "-v" or "--version" it will give you the version number!

0.1 Baby!

Writing Link Checker was not terribly difficult BUT it did involve some research and connections with fellow students. In my github readme you'll notice I used and sourced a few libraries, most of which were directly suggested by other students in OSD600. I also had the pleasure of working with another student on his own url verification app.

OSD600-Release0.1

Description of Tool

  • This is a command line tool that takes a file as input, reads and finds http:// and https:// links throughout the file and tells the user which ones are working and which ones are broken. Example usage: node lab1.js test.html
  • The tool will output all of the links in different colours: red (broken), green (not broken) unknown (grey). You may also give the agrument v or version to check the current version of the tool. If the user enters no arguments a standard help/usage message showing how to run the tool, which command line arguments can be passed will be showen.

Commands Available

  • node index.js v and node index.js version will print the current version of the tool.
  • node index.js test.html (or a different file) Grabs all links and outputs them with a status code (colour coded).
  • node index.js test.html --good Outputs only the links with…

Joey was great help! And together we improved our apps.

Honestly working on this with the OSD600 group and Joey has been an absolute joy and if this is what a taste of open source development can be like, I'm hungry for more.

Top comments (0)