aboutsummaryrefslogtreecommitdiff
path: root/cmd/verify.go
blob: 3ceabbee3eeacb836275e0b972ca9263ae521efa (plain) (blame)
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
package cmd

import (
	"github.com/axtloss/fsverify/core"
	"github.com/spf13/cobra"
)

func NewVerifyCommand() *cobra.Command {
	cmd := &cobra.Command{
		Use:          "verify",
		Short:        "Verify the root filesystem based on the given verification",
		RunE:         ValidateCommand,
		SilenceUsage: true,
	}

	return cmd
}

func ValidateCommand(_ *cobra.Command, args []string) error {
	node := core.Node{
		BlockStart:  0,
		BlockEnd:    4 * 1000,
		BlockSum:    "test",
		PrevNodeSum: "aaaa",
	}
	err := core.AddNode(node, nil)
	if err != nil {
		return err
	}
	_, err = core.ReadHeader("./test.part")
	return err
}