Skip to content

Commit

Permalink
Merge pull request #14 from Sharpz7/dev
Browse files Browse the repository at this point in the history
Fixed bugs on 3.2:
  • Loading branch information
Sharpz7 authored Nov 5, 2021
2 parents 540db8c + 22daba4 commit f623dbb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func client() {
var err error
var file []byte

if len(secretFlag) != 0 {
resp, err := http.Get(secretFlag)
if len(remoteFile) != 0 {
resp, err := http.Get(remoteFile)
handle(err, "Failed to download remote sharpcd.yml")
defer resp.Body.Close()

Expand Down Expand Up @@ -106,7 +106,7 @@ func post(payload postData, url string) (response, int) {

// Do Request
resp, err := client.Do(req)
handle(err, "Failed to do POST request")
handle(err, "Failed to do POST request to "+url)
defer resp.Body.Close()

// Read Body and Status
Expand Down
2 changes: 1 addition & 1 deletion src/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func handle(e error, msg string) {
fmt.Println(e)
}
ui.Close()
fmt.Print(msg)
fmt.Println(msg)
os.Exit(1)
}
}
Expand Down
14 changes: 10 additions & 4 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func init() {
// Creates Helper Function
flag.Usage = func() {
fmt.Println(`
Args of SharpCD:
- server: Run the sharpcd server
Expand All @@ -31,9 +32,14 @@ Args of SharpCD:
Sub Command Trak:
- alljobs {type}: Get info on all jobs
- job {type} {id}: Get info on job with logging
- list {type}: Get all jobs running on sharpcd server
- sharpcd trak alljobs {location} {type}
Get info on all jobs
- sharpcd trak job {location} {type} {id}
Get info on job with logging
- sharpcd trak list {location} {type}
Get all jobs running on sharpcd server
Flags:
`)
Expand Down Expand Up @@ -71,8 +77,8 @@ func main() {
case "version":
fmt.Println("Version: " + sharpCDVersion)
default:
log.Fatal("This subcommand does not exist!")
flag.Usage()
log.Fatal("This subcommand does not exist!")
}
}
return
Expand Down
8 changes: 4 additions & 4 deletions src/trak.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ func trak() {
case "list":
listJobs()
default:
handle(errors.New(""), "No valid trak arg was given")
flag.Usage()
handle(errors.New(""), "No valid trak arg was given")
}

}

// Lists all jobs running on server
func listJobs() {
if len(flag.Args()) < 3 {
handle(errors.New(""), "No valid location was given")
flag.Usage()
handle(errors.New(""), "No valid location was given")
}

var location = flag.Args()[2]
Expand Down Expand Up @@ -93,8 +93,8 @@ func liveFeed() {
var trakOne string = "job"

if len(flag.Args()) < 3 {
handle(errors.New(""), "No valid location was given")
flag.Usage()
handle(errors.New(""), "No valid location was given")
}

var trakArg = flag.Args()[1]
Expand All @@ -111,8 +111,8 @@ func liveFeed() {
// Only needed for single job requests
if trakArg == trakOne {
if len(flag.Args()) < 3 {
handle(errors.New(""), "No valid Job ID was given")
flag.Usage()
handle(errors.New(""), "No valid Job ID was given")
}

var jobID = flag.Args()[3]
Expand Down

0 comments on commit f623dbb

Please sign in to comment.