-
Notifications
You must be signed in to change notification settings - Fork 205
Open
Description
Description
The restore
command implementation requires at least one argument, but all examples in README.md show the command being used without any arguments.
Current Behavior
The code has Args: cobra.MinimumNArgs(1)
, requiring at least one positional argument:
Args: cobra.MinimumNArgs(1),
// ...
targetFile := args[0]
Documentation Shows
All restore examples in README.md use no arguments:
# Local file
DB_RESTORE_TARGET=/backup/db_backup_201509271627.gz ... restore
# SMB
DB_RESTORE_TARGET=smb://smbserver/share1/backup/db_backup_201509271627.gz ... restore
# S3
DB_RESTORE_TARGET=s3://bucket/path/db_backup_201509271627.gz ... restore
Problems
-
Immediate error: Running any README example results in:
Error: requires at least 1 arg(s), only received 0
-
Path handling issues: The code expects:
- Target: Directory path
- Argument: Filename
But README shows full paths in
DB_RESTORE_TARGET
.
Proposed Solution
The restore command should support both patterns for backward compatibility:
-
Full path pattern (as documented):
DB_RESTORE_TARGET=/path/to/file.tgz ./mysql-backup restore DB_RESTORE_TARGET=s3://bucket/path/file.tgz ./mysql-backup restore
-
Directory + filename pattern (original implementation):
DB_RESTORE_TARGET=/path/to/ ./mysql-backup restore file.tgz DB_RESTORE_TARGET=s3://bucket/path/ ./mysql-backup restore file.tgz
Related Issues
- Issue Restore from s3://path/to/xxx.tgz does not work in docker-compose.yml #432 reports the same "requires at least 1 arg(s)" error - this fix resolves it
- PR fixes path issue when reading dumps from s3 #435 attempts to fix S3 paths but only for the filename argument pattern. With our fix supporting the documented no-argument pattern, fixes path issue when reading dumps from s3 #435 may no longer be needed.
Impact
This affects all users following the README documentation for restore operations.
Would you like me to submit a PR that:
- Makes the positional argument optional
- Handles full paths in DB_RESTORE_TARGET correctly
- Maintains backward compatibility with the directory + filename pattern?
Metadata
Metadata
Assignees
Labels
No labels