Skip to content

Commit

Permalink
Add date prop
Browse files Browse the repository at this point in the history
  • Loading branch information
kondoumh committed Jun 4, 2020
1 parent 4db67a8 commit 1eb287e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/spf13/cobra"
)

const timeLayout = "2006-01-02 15:04"

var fetchCmd = &cobra.Command{
Use: "fetch",
Short: "Fetch all pages of the project",
Expand Down Expand Up @@ -87,6 +89,8 @@ func fetchPageList(project types.Project) error {
}
}
project.Pages = pages
jst, _ := time.LoadLocation("Asia/Tokyo")
project.Date = time.Now().In(jst).Format(timeLayout)
data, _ := json.Marshal(project)
if err := file.WriteBytes(data, project.Name+".json", config.WorkDir); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions pkg/types/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
// Project represents a Scrapbox project
type Project struct {
Name string `json:"projectName"`
Date string `json:"date"`
Count int `json:"count"`
Skip int `json:"skip"`
Pages []Page `json:"pages"`
Expand Down

0 comments on commit 1eb287e

Please sign in to comment.