Skip to content

Commit

Permalink
Support lakectl log since flag (#6854)
Browse files Browse the repository at this point in the history
* Support lakectl log since flag

* add missing flag and docs
  • Loading branch information
nopcoder authored Oct 25, 2023
1 parent 5a32e60 commit 0b263fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/lakectl/cmd/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/url"
"os"
"strings"
"time"

"github.com/spf13/cobra"
"github.com/treeverse/lakefs/pkg/api/apigen"
Expand Down Expand Up @@ -77,6 +78,7 @@ var logCmd = &cobra.Command{
amount := Must(cmd.Flags().GetInt("amount"))
after := Must(cmd.Flags().GetString("after"))
limit := Must(cmd.Flags().GetBool("limit"))
since := Must(cmd.Flags().GetString("since"))
dot := Must(cmd.Flags().GetBool("dot"))
firstParent := Must(cmd.Flags().GetBool("first-parent"))
objects := Must(cmd.Flags().GetStringSlice("objects"))
Expand Down Expand Up @@ -109,6 +111,13 @@ var logCmd = &cobra.Command{
if len(prefixes) > 0 {
logCommitsParams.Prefixes = &prefixes
}
if since != "" {
sinceParsed, err := time.Parse(time.RFC3339, since)
if err != nil {
DieFmt("Failed to parse 'since' - %s", err)
}
logCommitsParams.Since = &sinceParsed
}

graph := &dotWriter{
w: os.Stdout,
Expand Down Expand Up @@ -169,4 +178,5 @@ func init() {
logCmd.Flags().Bool("show-meta-range-id", false, "also show meta range ID")
logCmd.Flags().StringSlice("objects", nil, "show results that contains changes to at least one path in that list of objects. Use comma separator to pass all objects together")
logCmd.Flags().StringSlice("prefixes", nil, "show results that contains changes to at least one path in that list of prefixes. Use comma separator to pass all prefixes together")
logCmd.Flags().String("since", "", "show results since this date-time (RFC3339 format)")
}
1 change: 1 addition & 0 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -2673,6 +2673,7 @@ lakectl log --dot lakefs://example-repository/main | dot -Tsvg > graph.svg
--objects strings show results that contains changes to at least one path in that list of objects. Use comma separator to pass all objects together
--prefixes strings show results that contains changes to at least one path in that list of prefixes. Use comma separator to pass all prefixes together
--show-meta-range-id also show meta range ID
--since string show results since this date-time (RFC3339 format)
```


Expand Down

0 comments on commit 0b263fe

Please sign in to comment.