Skip to content

restore command requires argument but README shows none #470

@youngminz

Description

@youngminz

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

  1. Immediate error: Running any README example results in:

    Error: requires at least 1 arg(s), only received 0
    
  2. 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:

  1. 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
  2. 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

Impact

This affects all users following the README documentation for restore operations.

Would you like me to submit a PR that:

  1. Makes the positional argument optional
  2. Handles full paths in DB_RESTORE_TARGET correctly
  3. Maintains backward compatibility with the directory + filename pattern?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions