check / check (push) In progress
`vaultik snapshot files <snapshot-id> [path] [--json]` downloads and decrypts the snapshot database, as restore does, and prints mode, size, modification time and path for every file at or under the path. A path that matches nothing is an error. It needs the private key. The mode is in Go's file-mode notation, which the README spells out. Named `files` because `ls` is already the alias of `snapshot list`. The missing-key error no longer says "for restore", since this command and deep verify return it too. The README opening now states the private-key rule first. Model: opus-5-5
70 lines
1.5 KiB
Go
70 lines
1.5 KiB
Go
package cli_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"sneak.berlin/go/vaultik/internal/cli"
|
|
)
|
|
|
|
// TestCLIEntry ensures the CLI can be imported and basic initialization works
|
|
func TestCLIEntry(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
// This test primarily serves as a compilation test
|
|
// to ensure all imports resolve correctly
|
|
cmd := cli.NewRootCommand()
|
|
if cmd == nil {
|
|
t.Fatal("NewRootCommand() returned nil")
|
|
}
|
|
|
|
if cmd.Use != "vaultik" {
|
|
t.Errorf("Expected command use to be 'vaultik', got '%s'", cmd.Use)
|
|
}
|
|
|
|
// Verify all subcommands are registered
|
|
expectedCommands := []string{
|
|
"config", "snapshot", "prune", "info", "version", "remote", "database",
|
|
}
|
|
for _, expected := range expectedCommands {
|
|
found := false
|
|
|
|
for _, cmd := range cmd.Commands() {
|
|
if cmd.Use == expected || cmd.Name() == expected {
|
|
found = true
|
|
|
|
break
|
|
}
|
|
}
|
|
|
|
if !found {
|
|
t.Errorf("Expected command '%s' not found", expected)
|
|
}
|
|
}
|
|
|
|
// Verify snapshot command has subcommands
|
|
snapshotCmd, _, err := cmd.Find([]string{"snapshot"})
|
|
if err != nil {
|
|
t.Errorf("Failed to find snapshot command: %v", err)
|
|
} else {
|
|
// Check snapshot subcommands
|
|
expectedSubCommands := []string{
|
|
"create", "list", "files", "purge", "verify", "remove", "restore",
|
|
}
|
|
for _, expected := range expectedSubCommands {
|
|
found := false
|
|
|
|
for _, subcmd := range snapshotCmd.Commands() {
|
|
if subcmd.Use == expected || subcmd.Name() == expected {
|
|
found = true
|
|
|
|
break
|
|
}
|
|
}
|
|
|
|
if !found {
|
|
t.Errorf("Expected snapshot subcommand '%s' not found", expected)
|
|
}
|
|
}
|
|
}
|
|
}
|