gitdate

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DATE_FORMAT string = time.RFC3339

Variables

View Source
var DateArgvAction = func(c commander.Context) error {
	date, ok := c.GetString("<date>")
	if !ok || len(date) == 0 {
		return errors.New("ERROR: <date> should not be empty.")
	}

	offset, err := formatDate(date)
	if err != nil {
		return err
	}

	if c.Contain("--day") || c.Contain("--month") || c.Contain("--year") {
		offset = offset.AddDate(c.MustInt("--year"), c.MustInt("--month"), c.MustInt("--day"))
	}
	if i := c.MustInt("--hour"); i != 0 {
		offset = offset.Add(time.Duration(i) * time.Hour)
	}
	if i := c.MustInt("--minute"); i != 0 {
		offset = offset.Add(time.Duration(i) * time.Minute)
	}

	if offset.Equal(time.Now()) {
		return nil
	}

	return execCommandGitDate(offset.Unix())
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL