aboutsummaryrefslogtreecommitdiff
path: root/cmd/verify.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cmd/verify.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/cmd/verify.go b/cmd/verify.go
new file mode 100644
index 0000000..3ceabbe
--- /dev/null
+++ b/cmd/verify.go
@@ -0,0 +1,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
+}