Document autocomplete, add rm alias to delete

This commit is contained in:
Yiorgis Gozadinos 2025-09-05 12:04:20 +03:00
parent 572e3605fe
commit 13bbdc2ed6
No known key found for this signature in database
2 changed files with 26 additions and 2 deletions

View file

@ -2,6 +2,23 @@
The `haiku-rag` CLI provides complete document management functionality.
## Shell Autocompletion
Enable shell autocompletion for faster, errorfree usage.
- Temporary (current shell only):
```bash
eval "$(haiku-rag --show-completion)"
```
- Permanent installation:
```bash
haiku-rag --install-completion
```
Whats completed:
- `get` and `delete`/`rm`: Document IDs from the selected database (respects `--db`).
- `add-src`: Local filesystem paths (URLs can still be typed manually).
## Document Management
### List Documents
@ -26,13 +43,16 @@ haiku-rag add-src https://example.com/article.html
### Get Document
```bash
haiku-rag get 1
haiku-rag get <TAB>
# or
haiku-rag get 3f4a... # document ID (autocomplete supported)
```
### Delete Document
```bash
haiku-rag delete 1
haiku-rag delete <TAB>
haiku-rag rm <TAB> # alias
```
### Rebuild Database

View file

@ -190,6 +190,10 @@ def delete_document(
asyncio.run(app.delete_document(doc_id=doc_id))
# Add alias `rm` for delete
cli.command("rm", help="Alias for delete: remove a document by its ID")(delete_document)
@cli.command("search", help="Search for documents by a query")
def search(
query: str = typer.Argument(