added the ability to initiate a plex library scan from the CLI. tab completions are supported as well.

This commit is contained in:
Peter Wood
2025-06-26 09:07:51 -04:00
parent 57cd60cdf3
commit 563daa51af
11 changed files with 2170 additions and 81 deletions

View File

@@ -8,7 +8,38 @@ The completion system provides intelligent tab completion for command-line flags
## Supported Scripts
### backup-immich.sh
### Plex Management Scripts ⭐ **NEW**
#### plex.sh
- `start` - Start Plex Media Server
- `stop` - Stop Plex Media Server
- `restart` - Restart Plex Media Server
- `status` - Show detailed service status
- `scan` - Launch library scanner (with sub-commands)
- `repair` - Repair database corruption issues
- `nuclear` - Nuclear database recovery (last resort)
- `help` - Show help message
#### scan-plex-libraries.sh
- `list` - List all library sections
- `scan` - Scan for new media (with optional section ID)
- `refresh` - Refresh metadata (with optional section ID and force flag)
- `analyze` - Analyze media (with optional section ID and deep flag)
- `generate` - Generate thumbnails (with optional section ID)
- `tree` - Show library tree structure (requires section ID)
- `interactive` - Interactive mode
- `-v`, `--verbose` - Enable verbose output
- `-h`, `--help` - Show help message
#### Plex Aliases
- `plex`, `px` - Main plex.sh script with command completion
- `plex-start`, `plex-stop`, `plex-restart`, `plex-status` - Direct service commands
- `plex-scan` - Library scanner via plex.sh (supports scanner sub-commands)
- `plex-scanner` - Direct access to scan-plex-libraries.sh
### Backup Scripts
#### backup-immich.sh
- `--help`, `-h` - Show help message
- `--dry-run` - Preview backup without executing
@@ -73,6 +104,16 @@ autoload -U compinit && compinit -u
if [ -f "$HOME/shell/completions/backup-scripts-completion.bash" ]; then
source "$HOME/shell/completions/backup-scripts-completion.bash"
fi
# Load Plex scripts completion
if [ -f "$HOME/shell/completions/plex-scripts-completion.bash" ]; then
source "$HOME/shell/completions/plex-scripts-completion.bash"
fi
# Load environment backup completion
if [ -f "$HOME/shell/completions/env-backup-completion.bash" ]; then
source "$HOME/shell/completions/env-backup-completion.bash"
fi
```
## Usage Examples
@@ -89,6 +130,40 @@ $ backup-immich.sh --d<TAB>
$ backup-immich.sh --dry-run
```
### Plex Script Completion ⭐ **NEW**
```bash
# Main plex.sh command completion
$ plex.sh <TAB>
start stop restart status scan repair nuclear help
# Scanner sub-command completion when using scan
$ plex.sh scan <TAB>
list scan refresh analyze generate tree interactive -v --verbose -h --help
# Direct scanner script completion
$ scan-plex-libraries.sh <TAB>
list scan refresh analyze generate tree interactive
# Scanner options completion
$ scan-plex-libraries.sh -<TAB>
-v --verbose -h --help
# Boolean flag completion for refresh and analyze
$ scan-plex-libraries.sh refresh 29 <TAB>
true false
$ scan-plex-libraries.sh analyze 29 <TAB>
true false
# Alias completion works too
$ plex-scan <TAB>
list scan refresh analyze generate tree interactive
$ plex-scanner <TAB>
list scan refresh analyze generate tree interactive
```
### Webhook URL Completion
```bash