sub-cli/docs/examples.md
CDN deae4a6272
All checks were successful
Build and Release / Build (darwin-arm64) (push) Successful in 19s
Build and Release / Build (darwin-amd64) (push) Successful in 20s
Build and Release / Build (linux-arm64) (push) Successful in 17s
Build and Release / Build (linux-amd64) (push) Successful in 20s
Build and Release / Build (windows-arm64) (push) Successful in 16s
Build and Release / Build (windows-amd64) (push) Successful in 19s
Build and Release / Create Release (push) Has been skipped
Deploy docs / deploy (push) Successful in 45s
docs: init docs
2025-04-23 14:16:16 +08:00

63 lines
1.7 KiB
Markdown

---
title: Command Examples
description: Practical examples of Sub-CLI commands in action
---
# Command Examples
This page provides practical examples of Sub-CLI commands for common subtitle manipulation tasks.
## Format Conversion Examples
Convert between various subtitle formats:
```bash
# Convert from SRT to WebVTT
sub-cli convert subtitles.srt subtitles.vtt
# Convert from LRC to SRT
sub-cli convert lyrics.lrc subtitles.srt
# Convert from WebVTT to plain text (stripping timestamps)
sub-cli convert subtitles.vtt plain_text.txt
# Convert from SRT to LRC
sub-cli convert subtitles.srt lyrics.lrc
```
## Synchronization Examples
Synchronize timelines between subtitle files:
```bash
# Synchronize an SRT file using another SRT file as reference
sub-cli sync reference.srt target.srt
# Synchronize an LRC file using another LRC file as reference
sub-cli sync reference.lrc target.lrc
```
Note: Synchronization works between files of the same format. If the number of entries differs between source and target files, Sub-CLI will display a warning and scale the timeline appropriately.
## Formatting Examples
Format subtitle files for consistent styling:
```bash
# Format an SRT file
sub-cli fmt subtitles.srt
# Format an LRC file
sub-cli fmt lyrics.lrc
# Format a WebVTT file
sub-cli fmt subtitles.vtt
```
Formatting ensures:
- Sequential entry numbering
- Consistent timestamp formatting
- Proper spacing and line breaks
- Format-specific standard compliance
These examples demonstrate the versatility of Sub-CLI for handling various subtitle manipulation tasks. For detailed information on each command and all available options, see the [Command Reference](/commands) page.