github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/kbfstool/md_main.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/keybase/client/go/kbfs/libkbfs"
     7  	"golang.org/x/net/context"
     8  )
     9  
    10  const mdUsageStr = `Usage:
    11    kbfstool md [<subcommand>] [<args>]
    12  
    13  The possible subcommands are:
    14    dump	      Dump metadata objects
    15    check	      Check metadata objects and their associated blocks for errors
    16    reset	      Reset a broken top-level folder
    17    force-qr    Append a fake quota reclamation record to the folder history
    18  `
    19  
    20  func mdMain(ctx context.Context, config libkbfs.Config, args []string) (exitStatus int) {
    21  	if len(args) < 1 {
    22  		fmt.Print(mdUsageStr)
    23  		return 1
    24  	}
    25  
    26  	cmd := args[0]
    27  	args = args[1:]
    28  
    29  	switch cmd {
    30  	case "dump":
    31  		return mdDump(ctx, config, args)
    32  	case "check":
    33  		return mdCheck(ctx, config, args)
    34  	case "reset":
    35  		return mdReset(ctx, config, args)
    36  	case "force-qr":
    37  		return mdForceQR(ctx, config, args)
    38  	default:
    39  		printError("md", fmt.Errorf("unknown command %q", cmd))
    40  		return 1
    41  	}
    42  }