Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ yt videos update VIDEO_ID --title "New" # update metadata
yt videos update VIDEO_ID --tags "a,b,c"
```

### Bulk Operations
### Search & Replace

```bash
# search-replace (dry-run by default)
yt videos bulk-update -s "old" -r "new" --field title
yt videos bulk-update -s "old" -r "new" --field title --execute
yt videos bulk-update -s "^prefix" -r "" --regex --execute
# search-replace across videos (dry-run by default)
yt videos search-replace -s "old" -r "new" --field title
yt videos search-replace -s "old" -r "new" --field title --execute
yt videos search-replace -s "^prefix" -r "" --regex --execute
```

### Analytics
Expand Down
4 changes: 2 additions & 2 deletions src/ytcli/commands/videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ def update(
console.print(f"[green]✓ Updated: {new_title}[/green]")


@app.command("bulk-update")
def bulk_update(
@app.command("search-replace")
def search_replace(
search: str = typer.Option(..., "--search", "-s", help="Text to search for"),
replace: str = typer.Option(..., "--replace", "-r", help="Text to replace with"),
field: str = typer.Option("title", "--field", "-f", help="Field to update: title, description"),
Expand Down
16 changes: 8 additions & 8 deletions tests/test_videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,20 @@ def test_update_no_changes(self, mock_auth):
assert "Nothing to update" in result.stdout


class TestBulkUpdateCommand:
"""Test yt videos bulk-update command."""
class TestSearchReplaceCommand:
"""Test yt videos search-replace command."""

def test_bulk_update_no_matches(self, mock_auth):
"""Test bulk update with no matches."""
def test_search_replace_no_matches(self, mock_auth):
"""Test search-replace with no matches."""
result = runner.invoke(
app, ["videos", "bulk-update", "-s", "nonexistent_text", "-r", "new"]
app, ["videos", "search-replace", "-s", "nonexistent_text", "-r", "new"]
)

assert result.exit_code == 0
assert "No matches" in result.stdout

def test_bulk_update_missing_args(self):
"""Test bulk update requires search and replace."""
result = runner.invoke(app, ["videos", "bulk-update"])
def test_search_replace_missing_args(self):
"""Test search-replace requires search and replace."""
result = runner.invoke(app, ["videos", "search-replace"])

assert result.exit_code != 0
Loading