From b4aaa7bf127fd1e149f7472ff483c33a86a06c5c Mon Sep 17 00:00:00 2001 From: aga Date: Fri, 27 Mar 2026 12:08:00 +0100 Subject: [PATCH] Abbreviate CLI command names for improved ergonomics --- README.md | 21 +++++++++++---------- src/photo_tools/cli.py | 14 +++++++------- tests/test_cli.py | 6 +++--- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 717f74c..4588e5d 100644 --- a/README.md +++ b/README.md @@ -73,24 +73,25 @@ All commands support a `--dry-run` flag. Use this to safely preview changes befo - No directories are created - Actions are only printed +**All commands currently process files in the top-level input directory only.** -#### organise-by-date +#### by-date - Organise images into date-based folders (`YYYY-MM-DD`, optional suffix) - Files are moved (not copied) into the output directory - If a destination file already exists, it is skipped (no overwrite) ```shell -photo-tools organise-by-date +photo-tools by-date ``` ```shell -photo-tools organise-by-date --suffix +photo-tools by-date --suffix ``` ```shell -photo-tools organise-by-date --dry-run +photo-tools by-date --dry-run ``` -#### separate-raws +#### raws - Move RAW images into a `raws/` subfolder within the input directory - Non-RAW files are left unchanged @@ -98,24 +99,24 @@ photo-tools organise-by-date --dry-run - If a destination file already exists, it is skipped (no overwrite) ```shell -photo-tools separate-raws +photo-tools raws ``` ```shell -photo-tools separate-raws --dry-run +photo-tools raws --dry-run ``` -#### clean-unpaired-raws +#### clean-raws - Move RAW files to `raws-to-delete/` if no matching JPG (same prefix) exists - Matching is based on filename prefix (e.g. `abcd.RAF` matches `abcd_edit.jpg`) - Files are moved (not deleted), making the operation reversible ```shell -photo-tools clean-unpaired-raws +photo-tools clean-raws ``` ```shell -photo-tools clean-unpaired-raws --dry-run +photo-tools clean-raws --dry-run ``` #### optimise diff --git a/src/photo_tools/cli.py b/src/photo_tools/cli.py index 056441d..663d31d 100644 --- a/src/photo_tools/cli.py +++ b/src/photo_tools/cli.py @@ -24,25 +24,25 @@ def main() -> None: setup_logging() -@app.command("organise-by-date") +@app.command("by-date") def organise_by_date_cmd( input_dir: str = typer.Argument( ..., - help="Directory containing input images", + help="Directory containing input images.", ), output_dir: str = typer.Argument( ..., - help="Directory where organised images will be saved", + help="Directory where organised images will be saved.", ), suffix: str | None = typer.Option( None, "--suffix", - help="Optional suffix appended to folder names (e.g. location)", + help="Optional suffix appended to folder names (e.g. location).", ), dry_run: bool = typer.Option( False, "--dry-run", - help="Preview changes without moving files", + help="Preview changes without moving files.", ), ) -> None: """Organise images into folders based on capture date.""" @@ -50,7 +50,7 @@ def organise_by_date_cmd( @app.command( - "separate-raws", + "raws", help="Move RAW images into a 'raws' folder", ) def separate_raws_cmd( @@ -69,7 +69,7 @@ def separate_raws_cmd( @app.command( - "clean-unpaired-raws", + "clean-raws", help="Move RAW files without matching JPGs to 'raws-to-delete'.", ) def clean_unpaired_raws_cmd( diff --git a/tests/test_cli.py b/tests/test_cli.py index bd03164..b05211b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -13,7 +13,7 @@ def fake_which(_): monkeypatch.setattr("shutil.which", fake_which) - result = runner.invoke(app, ["organise-by-date", "in", "out"]) + result = runner.invoke(app, ["by-date", "in", "out"]) assert result.exit_code == 1 assert "Error:" in result.output @@ -49,7 +49,7 @@ def test_organise_by_date_command_moves_file(tmp_path, monkeypatch): result = runner.invoke( app, - ["organise-by-date", str(input_dir), str(output_dir)], + ["by-date", str(input_dir), str(output_dir)], ) assert result.exit_code == 0 @@ -74,7 +74,7 @@ def test_organise_by_date_command_dry_run_does_not_move_file(tmp_path, monkeypat result = runner.invoke( app, - ["organise-by-date", str(input_dir), str(output_dir), "--dry-run"], + ["by-date", str(input_dir), str(output_dir), "--dry-run"], ) assert result.exit_code == 0