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