Document autocomplete, add rm alias to delete
This commit is contained in:
parent
572e3605fe
commit
13bbdc2ed6
2 changed files with 26 additions and 2 deletions
24
docs/cli.md
24
docs/cli.md
|
|
@ -2,6 +2,23 @@
|
||||||
|
|
||||||
The `haiku-rag` CLI provides complete document management functionality.
|
The `haiku-rag` CLI provides complete document management functionality.
|
||||||
|
|
||||||
|
## Shell Autocompletion
|
||||||
|
|
||||||
|
Enable shell autocompletion for faster, error‑free usage.
|
||||||
|
|
||||||
|
- Temporary (current shell only):
|
||||||
|
```bash
|
||||||
|
eval "$(haiku-rag --show-completion)"
|
||||||
|
```
|
||||||
|
- Permanent installation:
|
||||||
|
```bash
|
||||||
|
haiku-rag --install-completion
|
||||||
|
```
|
||||||
|
|
||||||
|
What’s 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
|
## Document Management
|
||||||
|
|
||||||
### List Documents
|
### List Documents
|
||||||
|
|
@ -26,13 +43,16 @@ haiku-rag add-src https://example.com/article.html
|
||||||
### Get Document
|
### Get Document
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
haiku-rag get 1
|
haiku-rag get <TAB>
|
||||||
|
# or
|
||||||
|
haiku-rag get 3f4a... # document ID (autocomplete supported)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Delete Document
|
### Delete Document
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
haiku-rag delete 1
|
haiku-rag delete <TAB>
|
||||||
|
haiku-rag rm <TAB> # alias
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rebuild Database
|
### Rebuild Database
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,10 @@ def delete_document(
|
||||||
asyncio.run(app.delete_document(doc_id=doc_id))
|
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")
|
@cli.command("search", help="Search for documents by a query")
|
||||||
def search(
|
def search(
|
||||||
query: str = typer.Argument(
|
query: str = typer.Argument(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue