git_dailylog

package module
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 19 Imported by: 0

README

git-dailylog

commit log to dailylog

Description

ScreenShot

Usage

Initialize

create .dailylog format file or copy from ~/.dailylog

$ git dailylog init
Log Format File .dailylog

Reference: Git log format string cheatsheet

--pretty="format:[format]"

"%h: %ad %an: %s"
Get

get commit log from:time.start to:today.end

$ git dailylog get [time: default today]
TimeFormat

for example Today = 2018-06-28

format from to
today 2018-06-28 00:00:00 2018-06-28 23:59:59
yesterday 2018-06-27 00:00:00 2018-06-28 23:59:59
2days 2018-06-26 00:00:00 2018-06-28 23:59:59
1weeks 2018-06-21 00:00:00 2018-06-28 23:59:59
1month 2018-05-28 00:00:00 2018-06-28 23:59:59
1years 2017-06-28 00:00:00 2018-06-28 23:59:59
Options
Reverse

default git log Desc. Asc git log use when reverse option.

$ git dailylog get today --reverse
Author Filter
$ git dailylog get today --author=aozora0000

Install

homebrew
$ brew tap aozora0000/git-dailylog
$ brew install git-dailylog
go get

To install, use go get:

$ go get -d github.com/aozora0000/git-dailylog

Contribution

  1. Fork (https://github.com/aozora0000/git-dailylog/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create a new Pull Request

Author

aozora0000

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CmdGetCommand = &cli.Command{
	Name:   "get",
	Usage:  "Get abarge commit log formatted from .dailylog",
	Action: CmdGet,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "author",
			Value: "",
			Usage: "commit author filter",
		},
		&cli.BoolFlag{
			Name:  "reverse",
			Usage: "reverse output",
		},
	},
}
View Source
var CmdInitCommand = &cli.Command{
	Name:   "init",
	Usage:  "Initialize dailylog fotmat file. format reference: https://git-scm.com/docs/pretty-formats",
	Action: CmdInit,
	Flags:  []cli.Flag{},
}
View Source
var Initialfile = bytes.NewBufferString("\"%h: %ad %an: %s\"")
View Source
var SelfUpdateCommand = &cli.Command{
	Name:    "selfupdate",
	Aliases: []string{"self-update"},
	Usage:   "latest update from server",
	Action: func(context *cli.Context) error {
		if context.Bool("verbose") {
			selfupdate.EnableLog()
		}
		latest, found, err := selfupdate.DetectLatest(context.App.Metadata["Slug"].(string))
		if err != nil {
			log.Println("Error occurred while detecting version:", err)
			return err
		}
		v := semver.MustParse(strings.ReplaceAll(context.App.Version, "v", ""))
		if !found || latest.Version.LTE(v) {
			log.Println("Current version is the latest")
			return nil
		}

		fmt.Print("Do you want to update to ", latest.Version, " ? (y/n): ")
		input, err := bufio.NewReader(os.Stdin).ReadString('\n')
		if err != nil {
			return err
		}
		if input != "y\n" && input != "n\n" {
			return errors.New("Invalid input")
		}
		if input == "n\n" {
			return nil
		}

		exe, err := os.Executable()
		if err != nil {
			return err
		}
		if err := selfupdate.UpdateTo(latest.AssetURL, exe); err != nil {
			return err
		}
		log.Println("Successfully updated to version", latest.Version)
		return nil
	},
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "verbose",
			Aliases: []string{"v"},
			Usage:   "Verbose",
		},
	},
}

Functions

func CmdGet

func CmdGet(c *cli.Context) error

git log --after="2015-09-25 00:00:00" --before="2015-09-26 00:00:00" --date=local --pretty=format:"%h: %ad %an: %s" --author "Kazuhiko Hotta"

func CmdInit

func CmdInit(c *cli.Context) error

func Exists

func Exists(filename string) bool

Types

type BetweenTimestamps

type BetweenTimestamps struct {
	From *carbon.Carbon
	To   *carbon.Carbon
}

func (*BetweenTimestamps) IsBetween

func (s *BetweenTimestamps) IsBetween(t time.Time) bool

type Lines

type Lines struct {
	// contains filtered or unexported fields
}

func (*Lines) Get

func (s *Lines) Get(isReverse bool) chan string

func (*Lines) Normal

func (s *Lines) Normal() chan string

func (*Lines) Reverse

func (s *Lines) Reverse() chan string

type TimeDurationParser

type TimeDurationParser struct {
	// contains filtered or unexported fields
}

func (*TimeDurationParser) GetDay

func (*TimeDurationParser) GetToday

func (s *TimeDurationParser) GetToday() BetweenTimestamps

func (*TimeDurationParser) GetWeek

func (*TimeDurationParser) GetYear

func (*TimeDurationParser) GetYesterday

func (s *TimeDurationParser) GetYesterday() BetweenTimestamps

func (*TimeDurationParser) IsDay

func (s *TimeDurationParser) IsDay() bool

func (*TimeDurationParser) IsToday

func (s *TimeDurationParser) IsToday() bool

func (*TimeDurationParser) IsWeek

func (s *TimeDurationParser) IsWeek() bool

func (*TimeDurationParser) IsYear

func (s *TimeDurationParser) IsYear() bool

func (*TimeDurationParser) IsYesterday

func (s *TimeDurationParser) IsYesterday() bool

func (*TimeDurationParser) Parse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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