Skip to content

This get2json command-line tool mainly output the header information as Json format when input URLs.

License

Notifications You must be signed in to change notification settings

borischen0203/Get2Json

Repository files navigation

gopher-johnny

GitHub release

Get2Json

This get2json command-line tool mainly output the header information as Json format when input URLs.

Features

  • get command: Be able to output header information by inputting one or multiple URLs.

How to use

Sample URLs for input

http://www.bbc.co.uk/iplayer
http://checkip.amazonaws.com
https://www.bbc.co.uk/missing/thing
https://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Juvenile_Ragdoll.jpg/220px-Juvenile_Ragdoll.jpg
https://site.mockito.org/

Run in Docker:

Required

  • Install docker

Run process

Step1: Pull docker image(borischen0203/get2json)

docker pull borischen0203/get2json

Step2: Run docker image as below command

docker run -it --rm borischen0203/get2json get

or

docker run -v <file path>:<file path> -it --rm borischen0203/get2json get <file path>

Docker run demo

# Display the output header info when input URLs list
$ docker run -it --rm borischen0203/get2json get
$ Please enter URLs:
$ http://www.bbc.co.uk/iplayer
$ http://checkip.amazonaws.com
$ q #<--type[q + enter key] to quit input and run

$ Result:
{
   "Url": "http://www.bbc.co.uk/iplayer",
   "Status-Code": 301,
   "Content-Length": 169
}
{
   "Url": "http://checkip.amazonaws.com",
   "Status-Code": 200,
   "Content-Length": 15
}
# Display the output header info by input file path
$ docker run -v /Users/boris/Desktop/input.txt:/Users/boris/Desktop/input.txt -it --rm get2json get /Users/boris/Desktop/input.txt

$ Result:
{
   "Url": "http://www.bbc.co.uk/iplayer",
   "Status-Code": 301,
   "Content-Length": 169
}
{
   "Url": "http://checkip.amazonaws.com",
   "Status-Code": 200,
   "Content-Length": 15
}

Run in Local:

Required

brew install make

Run process

Step1: Clone the repo

git clone https://github.com/borischen0203/Get2Json.git

Step2: Use make to execute makefile run test and build

make all

Step3: Execute build file with get command

./bin/get2json get

or

./bin/get2json get <file path>

Local run demo

# Display the output header info when input URLs list
$ ./bin/get2json get
$ Please enter URLs:
$ http://www.bbc.co.uk/iplayer
$ http://checkip.amazonaws.com
$ q #<--type[q + enter key] to quit input and run

$ Result:
{
   "Url": "http://www.bbc.co.uk/iplayer",
   "Status-Code": 301,
   "Content-Length": 169
}
{
   "Url": "http://checkip.amazonaws.com",
   "Status-Code": 200,
   "Content-Length": 15
}
# Display the output header info by file path
$ ./bin/get2json get /Users/boris/Desktop/input.txt

$ Result:
{
   "Url": "http://www.bbc.co.uk/iplayer",
   "Status-Code": 301,
   "Content-Length": 169
}
{
   "Url": "http://checkip.amazonaws.com",
   "Status-Code": 200,
   "Content-Length": 15
}

Tech stack

  • Golang
  • Cobra
  • Docker
  • make
  • Github actions
  • shell
  • go Concurrency(WaitGroup)

Todo:

  • Be able to input file path.
  • Be able to output json file.

About

This get2json command-line tool mainly output the header information as Json format when input URLs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published