@@ -15,6 +15,12 @@ import (
1515 "berty.tech/yolo/v2/go/pkg/bintray"
1616 "berty.tech/yolo/v2/go/pkg/yolopb"
1717 "berty.tech/yolo/v2/go/pkg/yolosvc"
18+ "go.uber.org/zap"
19+ "golang.org/x/oauth2"
20+ "moul.io/godev"
21+ "moul.io/hcfilters"
22+ "moul.io/zapconfig"
23+
1824 "github.com/buildkite/go-buildkite/buildkite"
1925 "github.com/google/go-github/v32/github"
2026 "github.com/gregjones/httpcache"
@@ -28,11 +34,6 @@ import (
2834 ff "github.com/peterbourgon/ff/v2"
2935 "github.com/peterbourgon/ff/v2/ffcli"
3036 "github.com/tevino/abool"
31- "go.uber.org/zap"
32- "golang.org/x/oauth2"
33- "moul.io/godev"
34- "moul.io/hcfilters"
35- "moul.io/zapconfig"
3637)
3738
3839func main () {
@@ -264,7 +265,7 @@ func yolo(args []string) error {
264265
265266 ctx := context .Background ()
266267 input := & yolopb.DevDumpObjects_Request {
267- WithPreloading : withPreloading ,
268+ WithPreloading : true ,
268269 }
269270 ret , err := svc .DevDumpObjects (ctx , input )
270271 if err != nil {
@@ -276,6 +277,42 @@ func yolo(args []string) error {
276277 },
277278 }
278279
280+ tree := & ffcli.Command {
281+ Name : `tree` ,
282+ FlagSet : storeFlagSet ,
283+ Options : []ff.Option {ff .WithEnvVarNoPrefix ()},
284+ Exec : func (ctx context.Context , _ []string ) error {
285+ logger , err := loggerFromArgs (verbose , logFormat )
286+ if err != nil {
287+ return err
288+ }
289+ db , err := dbFromArgs (dbStorePath , logger )
290+ if err != nil {
291+ return err
292+ }
293+ defer db .Close ()
294+
295+ svc , err := yolosvc .NewService (db , yolosvc.ServiceOpts {
296+ Logger : logger ,
297+ DevMode : true ,
298+ })
299+ if err != nil {
300+ return err
301+ }
302+
303+ input := & yolopb.DevDumpObjects_Request {
304+ WithPreloading : true ,
305+ }
306+ ret , err := svc .DevDumpObjects (ctx , input )
307+ if err != nil {
308+ return err
309+ }
310+ fmt .Println (ret .Batch .DisplayTreeFormat ())
311+
312+ return nil
313+ },
314+ }
315+
279316 info := & ffcli.Command {
280317 Name : `info` ,
281318 FlagSet : storeFlagSet ,
@@ -313,7 +350,7 @@ func yolo(args []string) error {
313350 root := & ffcli.Command {
314351 ShortUsage : `server [flags] <subcommand>` ,
315352 FlagSet : rootFlagSet ,
316- Subcommands : []* ffcli.Command {server , dumpObjects , info },
353+ Subcommands : []* ffcli.Command {server , dumpObjects , info , tree },
317354 Options : []ff.Option {ff .WithEnvVarNoPrefix ()},
318355 Exec : func (_ context.Context , _ []string ) error {
319356 return flag .ErrHelp
0 commit comments