feat: add export/import functionality for backup and migration
Implemented roadmap #4: Export/import functionality. Features: - export <file> <key1> [key2...] - Export specified keys to JSON - export-list <keyfile> <output> - Bulk export from key list file - import <file> - Import keys from JSON file --skip-existing (default) - Skip keys that already exist --overwrite - Overwrite existing keys Export file format (v1.0): { "version": "1.0", "entries": [ { "key": "users/alice", "uuid": "...", "timestamp": 1234567890, "data": {...} } ] } The format preserves UUIDs and timestamps for audit trails. Export shows progress with ✓/✗/⊘ symbols for success/fail/not-found. Import checks for existing keys and respects skip/overwrite flags. Use cases: - Backup: export-list keys.txt backup.json - Migration: import backup.json --overwrite - Selective sync: export dest.json key1 key2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
6
main.go
6
main.go
@@ -60,6 +60,12 @@ func (c *KVSClient) executeCommand(line string) bool {
|
||||
}
|
||||
case "group":
|
||||
c.handleGroup(args)
|
||||
case "export":
|
||||
c.handleExport(args)
|
||||
case "import":
|
||||
c.handleImport(args)
|
||||
case "export-list":
|
||||
c.handleExportList(args)
|
||||
case "batch", "source":
|
||||
c.handleBatch(args, c.executeCommand)
|
||||
default:
|
||||
|
Reference in New Issue
Block a user