feat: add batch command execution from files

Implemented roadmap #3: Batch operations from file.

Features:
- batch <file> or source <file> - Execute commands from script file
- Skips empty lines and comments (lines starting with #)
- Shows line numbers during execution for easy debugging
- Blocks exit/quit commands in batch mode (won't exit shell)
- Displays execution summary with counts

Implementation:
- Refactored main loop to extract executeCommand() method
- Created cmd_batch.go with batch file processor
- Reads file line by line, processes each command
- Summary shows total lines, executed count, and skipped count

Example batch file:
  # Connect and setup
  connect http://localhost:8080
  auth <token>

  # Batch insert
  put key1 '{"data":"value1"}'
  put key2 '{"data":"value2"}'

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-05 23:54:47 +03:00
parent 33201227ca
commit 2f77c0a825
4 changed files with 142 additions and 52 deletions

View File

@@ -127,6 +127,8 @@ var completer = readline.NewPrefixCompleter(
readline.PcItem("add-member"),
readline.PcItem("remove-member"),
),
readline.PcItem("batch"),
readline.PcItem("source"),
readline.PcItem("help"),
readline.PcItem("exit"),
readline.PcItem("quit"),