doc: doc the --json option
This commit is contained in:
+58
-10
@@ -18,27 +18,38 @@ paperlib is designed as a **library engine** that higher-level tools can build u
|
||||
Most paperlib commands support `--json` output for automation:
|
||||
|
||||
```bash
|
||||
# Get library statistics
|
||||
# Get library configuration
|
||||
paperlib status --json
|
||||
{
|
||||
"success": true,
|
||||
"timestamp": "2024-01-15T10:30:00.000Z",
|
||||
"library_root": "/home/user/papers",
|
||||
"total_papers": 42,
|
||||
"by_status": {"converted": 38, "pending": 4},
|
||||
"last_updated": "2024-01-15T10:30:00Z"
|
||||
"config_path": "/home/user/papers/config/config.toml",
|
||||
"database_path": "/home/user/papers/db/paperlib.sqlite3",
|
||||
"papers_dir": "/home/user/papers/papers",
|
||||
"inbox_dir": "/home/user/papers/inbox",
|
||||
"cache_dir": "/home/user/papers/cache"
|
||||
}
|
||||
|
||||
# List papers with metadata
|
||||
paperlib list --json
|
||||
{
|
||||
"success": true,
|
||||
"timestamp": "2024-01-15T10:30:00.000Z",
|
||||
"papers": [
|
||||
{
|
||||
"paper_id": "arxiv-2212_06340",
|
||||
"source_type": "arxiv",
|
||||
"source_id": "2212.06340",
|
||||
"title": "Example Paper",
|
||||
"authors": ["Alice Smith", "Bob Jones"],
|
||||
"published_date": "2022-12-06T00:00:00.000Z",
|
||||
"categories": ["cs.AI"],
|
||||
"conversion_status": "success",
|
||||
"summary_status": "pending",
|
||||
"imported_at": "2024-01-15T10:30:00Z"
|
||||
"imported_at": "2024-01-15T10:30:00.000Z",
|
||||
"tags": [],
|
||||
"notes": ""
|
||||
}
|
||||
],
|
||||
"total": 1
|
||||
@@ -48,9 +59,46 @@ paperlib list --json
|
||||
paperlib import --arxiv 2212.06340 --json
|
||||
{
|
||||
"success": true,
|
||||
"timestamp": "2024-01-15T10:30:00.000Z",
|
||||
"paper_id": "arxiv-2212_06340",
|
||||
"title": "Example Paper Title",
|
||||
"message": "Successfully imported arXiv paper"
|
||||
"source_type": "arxiv",
|
||||
"source_id": "2212.06340",
|
||||
"authors": ["Alice Smith", "Bob Jones"],
|
||||
"message": "Successfully imported arXiv paper",
|
||||
"paper": {
|
||||
// Full paper metadata object
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Convert papers with JSON output
|
||||
paperlib convert --json
|
||||
{
|
||||
"success": true,
|
||||
"timestamp": "2024-01-15T10:30:00.000Z",
|
||||
"action": "convert_pending",
|
||||
"success_count": 5,
|
||||
"failure_count": 1,
|
||||
"total_attempted": 6
|
||||
}
|
||||
|
||||
# Reindex with JSON output
|
||||
paperlib reindex --json
|
||||
{
|
||||
"success": true,
|
||||
"timestamp": "2024-01-15T10:30:00.000Z",
|
||||
"reindex_complete": true,
|
||||
"papers_indexed": 42,
|
||||
"errors": 1,
|
||||
"statistics": {
|
||||
"total_papers": 42,
|
||||
"by_source_type": {
|
||||
"arxiv": 38,
|
||||
"local": 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -89,8 +137,8 @@ while read arxiv_id; do
|
||||
paperlib import --arxiv "$arxiv_id" --library "$LIBRARY" --json
|
||||
done
|
||||
|
||||
# Convert newly imported papers
|
||||
paperlib convert --library "$LIBRARY"
|
||||
# Convert newly imported papers with JSON output
|
||||
paperlib convert --library "$LIBRARY" --json
|
||||
|
||||
# Generate daily report
|
||||
paperlib list --library "$LIBRARY" --json | \
|
||||
@@ -120,8 +168,8 @@ while IFS= read -r pdf_path; do
|
||||
fi
|
||||
done < "$PAPER_LIST"
|
||||
|
||||
# Convert all pending papers
|
||||
paperlib convert --library "$LIBRARY"
|
||||
# Convert all pending papers with JSON output
|
||||
paperlib convert --library "$LIBRARY" --json
|
||||
```
|
||||
|
||||
## Python API
|
||||
|
||||
Reference in New Issue
Block a user