Skip to content

Commit

Permalink
printVersion deferral after About + version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Odeke committed Jan 13, 2015
1 parent dd28241 commit 5a304a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
drive "github.com/google/google-api-go-client/drive/v2"
)

const Version = "0.0.5"

const (
Barely = iota
AlmostExceeded
Expand All @@ -35,7 +37,7 @@ const (
)

func (g *Commands) About(mask int) (err error) {
PrintVersion()
defer PrintVersion()
if mask == AboutNone {
return nil
}
Expand Down Expand Up @@ -81,6 +83,7 @@ func fileSizesInfo(about *drive.About) {
for _, uploadInfo := range about.MaxUploadSizes {
fmt.Printf("%-36s %-36s\n", uploadInfo.Type, prettyBytes(uploadInfo.Size))
}
fmt.Println()
}
return
}
Expand All @@ -94,6 +97,7 @@ func featuresInformation(about *drive.About) {
}
fmt.Printf("%-30s %-30f\n", feature.FeatureName, feature.FeatureRate)
}
fmt.Println()
}
}

Expand All @@ -119,6 +123,7 @@ func quotaInformation(about *drive.About) {
fmt.Printf("%-36s %-36s\n", "Space used by all Google Apps",
prettyBytes(about.QuotaBytesUsedAggregate))
}
fmt.Println()
}

func (g *Commands) QuotaStatus(query int64) (status int, err error) {
Expand Down
2 changes: 0 additions & 2 deletions src/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
"fmt"
)

var Version = "0.0.4d"

const (
AboutKey = "about"
AllKey = "all"
Expand Down
16 changes: 9 additions & 7 deletions src/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ func (r *Remote) Touch(id string) error {
return err
}

func toUTCString(t time.Time) string {
utc := t.UTC().Round(time.Second)
// Ugly but straight forward formatting as time.Parse is such a prima donna
return fmt.Sprintf("%d-%02d-%02dT%02d:%02d:%0d.000Z",
utc.Year(), utc.Month(), utc.Day(),
utc.Hour(), utc.Minute(), utc.Second())
}

func (r *Remote) UpsertByComparison(parentId, fsAbsPath string, src, dest *File) (f *File, err error) {
var body io.Reader
body, err = os.Open(fsAbsPath)
Expand All @@ -265,14 +273,8 @@ func (r *Remote) UpsertByComparison(parentId, fsAbsPath string, src, dest *File)
uploaded.MimeType = DriveFolderMimeType
}

utc := src.ModTime.UTC().Round(time.Second)

// Ugly but straight forward formatting because time.Parse is such a prima donna
str := fmt.Sprintf("%d-%02d-%02dT%02d:%02d:%0d.000Z",
utc.Year(), utc.Month(), utc.Day(), utc.Hour(), utc.Minute(), utc.Second())

// Ensure that the ModifiedDate is retrieved from local
uploaded.ModifiedDate = str
uploaded.ModifiedDate = toUTCString(src.ModTime)

if src.Id == "" {
req := r.service.Files.Insert(uploaded)
Expand Down

0 comments on commit 5a304a7

Please sign in to comment.