|
|
|
@ -7,6 +7,7 @@ package cmd
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
|
"git.nagee.dev/isthisnagee/diary/model"
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
)
|
|
|
|
@ -23,6 +24,7 @@ var todayCmd = &cobra.Command{
|
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
|
var created_after_ts *int64 = new(int64)
|
|
|
|
|
var created_before_ts *int64 = new(int64)
|
|
|
|
|
var num_entries *int64 = new(int64)
|
|
|
|
|
|
|
|
|
|
var now = time.Now()
|
|
|
|
|
var startOfToday = time.Date(
|
|
|
|
@ -39,9 +41,13 @@ var todayCmd = &cobra.Command{
|
|
|
|
|
var endOfToday = startOfToday.AddDate(0, 0, 1)
|
|
|
|
|
*created_before_ts = endOfToday.Unix()
|
|
|
|
|
|
|
|
|
|
if viper.GetInt64("listNumEntries") > 0 {
|
|
|
|
|
*num_entries = viper.GetInt64("listNumEntries")
|
|
|
|
|
}
|
|
|
|
|
results := App.Db.GetDiaryEntries(model.GetDiaryEntriesQuery{
|
|
|
|
|
CreatedBeforeTs: created_before_ts,
|
|
|
|
|
CreatedAfterTs: created_after_ts,
|
|
|
|
|
NumEntries: num_entries,
|
|
|
|
|
})
|
|
|
|
|
PrintEntries(results)
|
|
|
|
|
|
|
|
|
|