| 35 | const revsJSONStatusRevision = "revision" |
| 36 | |
| 37 | func revs(cmd *cobra.Command, args []string) (err error) { |
| 38 | if len(args) != 1 { |
| 39 | return invalidArgumentsErrorWithDetails("`revs` requires a `file` argument", argumentErrorDetails("file")) |
| 40 | } |
| 41 | |
| 42 | path, err := validatePath(args[0]) |
| 43 | if err != nil { |
| 44 | return |
| 45 | } |
| 46 | |
| 47 | arg := files.NewListRevisionsArg(path) |
| 48 | limit, _ := cmd.Flags().GetUint64("limit") |
| 49 | if limit > 0 { |
| 50 | arg.Limit = limit |
| 51 | } |
| 52 | |
| 53 | opts, err := parseListOptions(cmd) |
| 54 | if err != nil { |
| 55 | return err |
| 56 | } |
| 57 | |
| 58 | dbx := filesNewFunc(config) |
| 59 | res, err := dbx.ListRevisionsContext(currentContext(), arg) |
| 60 | if err != nil { |
| 61 | return |
| 62 | } |
| 63 | |
| 64 | return renderRevisionsOutput(cmd, path, limit, res.Entries, opts) |
| 65 | } |
| 66 | |
| 67 | func renderRevisionsOutput(cmd *cobra.Command, path string, limit uint64, entries []*files.FileMetadata, opts listOptions) error { |
| 68 | out := commandOutput(cmd) |