handle version in cli

This commit is contained in:
Simone Scarduzio
2025-10-12 17:47:05 +02:00
parent 67792b2031
commit 14c6af0f35
2 changed files with 33 additions and 0 deletions

View File

@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- **New CLI Command**: `deltaglider migrate` for S3-to-S3 bucket migration with compression
- Supports resume capability (skips already migrated files)
- Real-time progress tracking with file count and statistics
- Interactive confirmation prompt (use `--yes` to skip)
- Prefix preservation by default (use `--no-preserve-prefix` to disable)
- Dry run mode with `--dry-run` flag
- Include/exclude pattern filtering
- Shows compression statistics after migration
- **S3-to-S3 Recursive Copy**: `deltaglider cp -r s3://source/ s3://dest/` now supported
- Automatically uses migration functionality with prefix preservation
- Applies delta compression during transfer
- **Version Command**: Added `--version` flag to show deltaglider version
- Usage: `deltaglider --version`
### Changed
- Recursive S3-to-S3 copy operations now preserve source prefix structure by default
- Migration operations show formatted output with source and destination paths
### Documentation
- Added comprehensive migration guide in README.md
- Updated CLI reference with migrate command examples
- Added prefix preservation behavior documentation
## [5.1.1] - 2025-01-10
### Fixed

View File

@@ -10,6 +10,7 @@ from pathlib import Path
import click
from ... import __version__
from ...adapters import (
NoopMetricsAdapter,
S3StorageAdapter,
@@ -113,8 +114,16 @@ def create_service(
)
def _version_callback(ctx: click.Context, param: click.Parameter, value: bool) -> None:
"""Callback for --version option."""
if value:
click.echo(f"deltaglider {__version__}")
ctx.exit(0)
@click.group()
@click.option("--debug", is_flag=True, help="Enable debug logging")
@click.option("--version", is_flag=True, is_eager=True, expose_value=False, callback=_version_callback, help="Show version and exit")
@click.pass_context
def cli(ctx: click.Context, debug: bool) -> None:
"""DeltaGlider - Delta-aware S3 file storage wrapper."""