Documentation ¶
Index ¶
Constants ¶
View Source
const ( TODAY int = 1 << (10 * iota) YESTERDAY LAST_WEEK DAYS DATE )
View Source
const ( FORMAT_DEFAULT = FORMAT_RAW FORMAT_RAW = "raw" FORMAT_TABLE = "table" FORMAT_MD = "md" FORMAT_GROUP_LINE = "groupline" FORMAT_CSV = "csv" FORMAT_HTML = "html" )
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "github-journaling-aggregator", Short: "Create a simple report using your activity feed at GitHub", Long: `Create a simple report using your activity feed at GitHub. Will receive a access token and beginning date to generate a report based on the users activity feed on GitHub`, Args: validateArgs, Run: func(cmd *cobra.Command, args []string) { var beginningDate time.Time = time.Now() switch dateFilterType { case YESTERDAY: beginningDate = time.Now().AddDate(0, 0, -1) case LAST_WEEK: beginningDate = time.Now().AddDate(0, 0, -1*int(time.Now().Weekday())) case DAYS: beginningDate = time.Now().AddDate(0, 0, days*-1) case DATE: var err error beginningDate, err = time.Parse("2006-01-02", date) if err != nil { log.Fatal(err) } } y, m, d := beginningDate.Date() beginningDate = time.Date(y, m, d, 0, 0, 0, 0, time.Local) ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token}) tc := oauth2.NewClient(context.Background(), ts) client := github.NewClient(tc) r := report.New(client, beginningDate) f, err := getFormatter(beginningDate) if err != nil { log.Fatal(err) } r.AttachFormatter(f) filt, err := getFilter() if err != nil { log.Fatal(err) } r.SetFilter(filt) r.Run() }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.