updated CLI

This commit is contained in:
thePR0M3TH3AN
2025-05-15 16:37:59 -04:00
parent 84df958978
commit a38f613a79
13 changed files with 443 additions and 57 deletions

View File

@@ -145,26 +145,26 @@ Paste & run each block in your terminal.
---
### 0Prepare & build
### 0Prepare, build & install
```bash
# Clone or cd into your Marlin repo
cd ~/Documents/GitHub/Marlin
# Build the release binary
cargo build --release
```
sudo install -Dm755 target/release/marlin /usr/local/bin/marlin
````
> Now `marlin` is available everywhere.
---
### 1Install on your PATH
### 1Enable shell completion (optional but handy)
```bash
sudo install -Dm755 target/release/marlin /usr/local/bin/marlin
marlin completions bash > ~/.config/bash_completion.d/marlin
# or for zsh / fish, similarly...
```
> Now `marlin` is available everywhere.
---
### 2Prepare a clean demo directory
@@ -184,16 +184,14 @@ printf "fake jpg\n" > ~/marlin_demo/Media/Photos/vacation.jpg
### 3Initialize & index files
```bash
# Use --verbose if you want full debug traces:
marlin init
marlin scan ~/marlin_demo
# or, to see every path tested:
marlin --verbose init
# show every path tested:
marlin --verbose scan ~/marlin_demo
```
> **Tip:** Rerun `marlin scan` after you add/remove/modify files; only changed files get re-indexed.
> Only changed files get re-indexed on subsequent runs.
---
@@ -204,11 +202,10 @@ marlin --verbose scan ~/marlin_demo
marlin tag "~/marlin_demo/Projects/Alpha/**/*" project/alpha
# Mark all PDFs as reviewed
marlin attr set "~/marlin_demo/**/*.pdf" reviewed yes
marlin attr set "~/marlin_demo/**/*.pdf" reviewed=yes
# (or with debug)
marlin --verbose tag "~/marlin_demo/Projects/Alpha/**/*" project/alpha
marlin --verbose attr set "~/marlin_demo/**/*.pdf" reviewed yes
# Output as JSON instead:
marlin --format=json attr set "~/marlin_demo/**/*.pdf" reviewed=yes
```
---
@@ -219,38 +216,34 @@ marlin --verbose attr set "~/marlin_demo/**/*.pdf" reviewed yes
# By tag or filename
marlin search alpha
# Combined terms (AND across path+attrs)
# Combined terms:
marlin search "reviewed AND pdf"
# Run a command on each hit
marlin search reviewed --exec "echo HIT → {}"
# If things arent matching, add --verbose to see the underlying FTS query:
marlin --verbose search "reviewed AND pdf"
# Run a command on each hit:
marlin search reviewed --exec 'echo HIT → {}'
```
> `{}` in `--exec` is replaced with each files path.
---
### 6Backup & restore
```bash
# Snapshot and store its name
# Snapshot
snap=$(marlin backup | awk '{print $NF}')
# Simulate data loss
# Simulate loss
rm ~/.local/share/marlin/index.db
# Restore instantly
# Restore
marlin restore "$snap"
# Verify your files still show up
# Verify
marlin search reviewed
```
> Backups live under `~/.local/share/marlin/backups` by default.
##### What you just exercised
| Command | Purpose |