summaryrefslogtreecommitdiff
path: root/cmd/btrfs-rec/inspect_rebuildtrees.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-03-06 10:42:51 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-03-14 21:31:45 -0600
commit058f8c36f6bf9ae2600bf7da33d680ced41eae9a (patch)
treec31b472fb024f5e046c5ed51cbeade831e0454fa /cmd/btrfs-rec/inspect_rebuildtrees.go
parentf19d908439b3537cc6ae7a21eb926763e90d44ee (diff)
cmd/btrfs-rec: Have each subcommand call runWithRawFS itself
Diffstat (limited to 'cmd/btrfs-rec/inspect_rebuildtrees.go')
-rw-r--r--cmd/btrfs-rec/inspect_rebuildtrees.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/cmd/btrfs-rec/inspect_rebuildtrees.go b/cmd/btrfs-rec/inspect_rebuildtrees.go
index 5d782cf..8c6fc92 100644
--- a/cmd/btrfs-rec/inspect_rebuildtrees.go
+++ b/cmd/btrfs-rec/inspect_rebuildtrees.go
@@ -21,12 +21,10 @@ import (
)
func init() {
- inspectors = append(inspectors, subcommand{
- Command: cobra.Command{
- Use: "rebuild-nodes NODESCAN.json",
- Args: cliutil.WrapPositionalArgs(cobra.ExactArgs(1)),
- },
- RunE: func(fs *btrfs.FS, cmd *cobra.Command, args []string) error {
+ inspectors.AddCommand(&cobra.Command{
+ Use: "rebuild-nodes NODESCAN.json",
+ Args: cliutil.WrapPositionalArgs(cobra.ExactArgs(1)),
+ RunE: runWithRawFS(func(fs *btrfs.FS, cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
// This is wrapped in a func in order to *ensure* that `nodeList` goes out of scope once
@@ -66,6 +64,6 @@ func init() {
dlog.Info(ctx, "... done writing")
return rebuildErr
- },
+ }),
})
}