go-cat-tool
is a command-line tool built in Go that is my version of the built in cat tool. This was done as part of this coding challenge Build Your Own cat Tool
from https://codingchallenges.fyi/challenges/challenge-cat/
Follow the instructions below to clone the repository and install the executable on your local machine.
To install and run go-cat-tool
on your machine, follow these steps:
First, clone the GitHub repository to your local machine using the following command:
git clone https://github.com/garethbreeze1993/go-cat-tool.git
Move into the cloned directory:
cd go-cat-tool
Run the following command to install the go-cat-tool executable:
go install
This will compile the source code and place the binary into your $GOPATH/bin directory, making the tool available globally from your terminal.
Once installed, you can run the tool from anywhere in your terminal:
go-cat-tool [options] [arguments]
--number, -n: Whether user wants all lines numbered (default: false)
--nonblank, -b: Whether user wants only non-blank lines numbered (default: false)
Note: You can use either the --number
or --nonblank
flag, or omit both if you don't want any lines numbered.
[file paths...]: One or more paths to files on the user's computer.
For example, to display all lines with line numbers from a file:
go-cat-tool -n /path/to/file
Or, to number only non-blank lines:
go-cat-tool -b /path/to/file
Finally to just display all lines without line numbers use this
go-cat-tool /path/to/file
Go must be installed on your machine. You can download it from the official Go website. Ensure your $GOPATH/bin is added to your system's PATH.
For more details on how to use go-cat-tool, check out the Usage section below or run:
go-cat-tool --help