3 releases
0.1.2 | Oct 16, 2024 |
---|---|
0.1.1 | Oct 16, 2024 |
0.1.0 | Oct 16, 2024 |
#803 in Command line utilities
16KB
306 lines
#Use Memos CLI
Memos CLI is a command-line interface tool for managing memos through a self-hosted API. It allows users to retrieve, create, and update memos efficiently.
Features
- Retrieve all memos from the API
- Create new memos (placeholder functionality)
- Update existing memos (single or bulk update)
- Save memos as local files
- Maintain memo metadata in a JSON file
Installation
- Ensure you have Rust and Cargo installed on your system.
- Clone this repository:
git clone https://github.com/yourusername/memos-cli.git cd use-memos-cli
- Build the project:
cargo build --release
- The binary will be available in
target/release/use-memos-cli
Usage
Before using the CLI, make sure to set the following environment variables:
MEMOAPI
: Your API authentication tokenMEMO_DOMAIN
: The domain of your self-hosted memo instance
You can set these in a .env
file in the project root.
General Command Structure
use-memos-cli [OPTIONS] --endpoint <ENDPOINT>
Options
-m, --memo-domain <MEMO_DOMAIN>
: Memo domain of self-hosted instance-e, --endpoint <ENDPOINT>
: API endpoint to call (getMemos, createMemo, updateMemo)-o, --output-dir <OUTPUT_DIR>
: Output directory for files [default: content]-v, --verbose
: Verbose mode-n, --memo-name <MEMO_NAME>
: Memo name or uid (for single memo operations)-c, --content <CONTENT>
: Optional content for memo creation or update--bulk-update
: Flag for bulk update of memos
Examples
-
Retrieve all memos:
use-memos-cli --endpoint getMemos
-
Update a single memo:
use-memos-cli --endpoint updateMemo --memo-name <MEMO_UID> --content "Updated content"
-
Bulk update all memos:
use-memos-cli --endpoint updateMemo --bulk-update
Project Structure
src/
main.rs
: Entry point of the applicationcli.rs
: CLI argument parsingutils.rs
: Utility functionsapi/
mod.rs
: API module definitionsgetMemos.rs
: Functions for retrieving memoscreateMemo.rs
: Functions for creating memos (placeholder)updateMemo.rs
: Functions for updating memos
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Dependencies
~10–23MB
~331K SLoC