aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorTeddy Wing2017-06-04 00:42:49 +0200
committerTeddy Wing2017-06-04 00:42:49 +0200
commit7a2e44aab9398aea62625fe15af1f6ac13af4226 (patch)
treebf501155b2ee8e23bead890fb0d54864a4b6d8e8 /main.go
parent34fb8b7b98076b65b05efc2bbaff013fbbbf5116 (diff)
parent288bceba90874e4221d8a43757b0fe1c82f5af6d (diff)
downloadtimetasker-7a2e44aab9398aea62625fe15af1f6ac13af4226.tar.bz2
Merge branch 'move-http-errors-to-http.go' into timetasker-daily
Diffstat (limited to 'main.go')
-rw-r--r--main.go26
1 files changed, 2 insertions, 24 deletions
diff --git a/main.go b/main.go
index 1521821..2f37632 100644
--- a/main.go
+++ b/main.go
@@ -2,9 +2,7 @@ package main
import (
"fmt"
- "io/ioutil"
"os"
- "strings"
"time"
"github.com/teddywing/timetasker/timetask"
@@ -93,22 +91,12 @@ func main() {
password, err := passwordCmd(config.Auth.PasswordCmd)
kingpin.FatalIfError(err, "password command failed")
- resp, client, err := timetask.Login(
+ client, err := timetask.Login(
config.Auth.Username,
password,
)
kingpin.FatalIfError(err, "login request failed")
- defer resp.Body.Close()
- body, err := ioutil.ReadAll(resp.Body)
- if strings.Contains(
- string(body),
- "The username and password don't appear to be valid.",
- ) {
- kingpin.Errorf("TimeTask authentication failed")
- os.Exit(1)
- }
-
// List modules
if *list_modules {
modules, err := timetask.RequestModules(*client, time_entry)
@@ -118,16 +106,6 @@ func main() {
os.Exit(0)
}
- resp, err = timetask.SubmitTimeEntry(*client, time_entry)
+ err = timetask.SubmitTimeEntry(*client, time_entry)
kingpin.FatalIfError(err, "time entry submission request failed")
-
- defer resp.Body.Close()
- body, err = ioutil.ReadAll(resp.Body)
- if strings.Contains(
- string(body),
- "No time entries were created.",
- ) {
- kingpin.Errorf("time entry creation failed")
- os.Exit(1)
- }
}