119 lines
2.5 KiB
Markdown
119 lines
2.5 KiB
Markdown
# CodiMD CLI Harness
|
|
|
|
A stateful CLI for [CodiMD](https://github.com/hackmdio/codimd) - collaborative markdown notes on all platforms.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
pip install cli-anything-codimd
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Set your CodiMD server
|
|
cli-anything-codimd config set server https://your-codimd-server.com
|
|
|
|
# List your notes
|
|
cli-anything-codimd note list
|
|
|
|
# Create a new note
|
|
cli-anything-codimd note create --content "# My New Note\n\nHello world"
|
|
|
|
# Get note content
|
|
cli-anything-codimd note get <note-id>
|
|
|
|
# Export as markdown
|
|
cli-anything-codimd export markdown <note-id> --output note.md
|
|
|
|
# Get user info
|
|
cli-anything-codimd user me
|
|
```
|
|
|
|
## Commands
|
|
|
|
### Note Operations
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `note list` | List user's notes |
|
|
| `note get <id>` | Get note content |
|
|
| `note create` | Create new note |
|
|
| `note update <id>` | Update note content |
|
|
| `note delete <id>` | Delete note |
|
|
| `note info <id>` | Get note metadata |
|
|
| `note publish <id>` | Get publish link |
|
|
|
|
### User Operations
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `user me` | Get current user info |
|
|
| `user login` | Login to server |
|
|
| `user logout` | Logout from session |
|
|
| `user export` | Export all user data |
|
|
| `user delete` | Delete user account |
|
|
|
|
### Export Operations
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `export markdown <id>` | Export as markdown |
|
|
| `export pdf <id>` | Export as PDF |
|
|
| `export html <id>` | Export as HTML |
|
|
| `export slide <id>` | Export as reveal.js slides |
|
|
|
|
### Revision Operations
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `revision list <id>` | List note revisions |
|
|
| `revision get <id> <time>` | Get note at specific time |
|
|
|
|
### Configuration
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `config get [key]` | Get configuration value |
|
|
| `config set <key> <value>` | Set configuration value |
|
|
|
|
## JSON Output Mode
|
|
|
|
All commands support `--json` flag for machine-readable output:
|
|
|
|
```bash
|
|
cli-anything-codimd --json note list
|
|
```
|
|
|
|
Response format:
|
|
```json
|
|
{
|
|
"status": "success|error",
|
|
"data": {...},
|
|
"error": "error message if status is error"
|
|
}
|
|
```
|
|
|
|
## Session Management
|
|
|
|
The CLI stores session data in `~/.config/cli-anything-codimd/`:
|
|
- `session.json`: Auth tokens and session data
|
|
- `config.json`: Server configuration
|
|
|
|
## Development
|
|
|
|
```bash
|
|
# Install in development mode
|
|
pip install -e .
|
|
|
|
# Run tests
|
|
pytest cli_anything/codimd/tests/ -v
|
|
|
|
# Run with specific command
|
|
python -m cli_anything.codimd.codimd_cli --help
|
|
```
|
|
|
|
## License
|
|
|
|
MIT License
|