Skip to content

Commit

Permalink
Official all works completely.
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahcruz12 committed Jun 24, 2021
1 parent a3108ce commit ed761d1
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 2 deletions.
Binary file modified build/up-darwin-amd64
Binary file not shown.
Binary file modified build/up-linux-386
Binary file not shown.
Binary file modified build/up-linux-amd64
Binary file not shown.
Binary file modified build/up-linux-arm
Binary file not shown.
Binary file modified build/up-linux-arm64
Binary file not shown.
Binary file modified build/up-windows-386.exe
Binary file not shown.
Binary file modified build/up-windows-amd64.exe
Binary file not shown.
27 changes: 25 additions & 2 deletions up.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ import (
"fmt"
"net/http"
"os"
"time"
)

func main() {

resp, err := http.Get("http://example.com")
client := http.Client{
Timeout: 5 * time.Second,
}

resp, err := client.Get("http://example.com")

var first string

Expand All @@ -26,15 +31,33 @@ func main() {
getLongAnswer(err)
} else if first == "short" {
getShortAnswer(err)
} else if first == "help" {
helpScreen()
} else if first == "--help" {
helpScreen()
} else {
fmt.Println("Option not defined")
}
}

getLongAnswer(err)
func helpScreen() {
fmt.Println("Up (http-up) version 1.1.0")
fmt.Println("By Elijah Cruz")
fmt.Println()
fmt.Println("Allows you to check the status of your internet")
fmt.Println()
fmt.Printf("")
fmt.Println("Options:")
fmt.Println(" - <none>: Equivalent of long")
fmt.Println(" - long: Displays a longer more human readable version of your internet status.")
fmt.Println(" - short: Displays either \"up\" or \"down\" depending on your internet is up or down.")
fmt.Println(" - help: This help message")
}

func getLongAnswer(err interface{}) {

fmt.Println("Getting you internet status")

if err != nil {
fmt.Println("Internet is down")

Expand Down

0 comments on commit ed761d1

Please sign in to comment.