| Crates.io | notion-cli-rs |
| lib.rs | notion-cli-rs |
| version | 0.1.1 |
| created_at | 2025-01-11 12:36:54.91934+00 |
| updated_at | 2025-01-11 13:03:16.829282+00 |
| description | A powerful command-line interface for managing Notion tasks |
| homepage | https://github.com/CharlonTank/notion-cli-rs |
| repository | https://github.com/CharlonTank/notion-cli-rs |
| max_upload_size | |
| id | 1512336 |
| size | 126,302 |
A powerful command-line interface for managing Notion tasks, written in Rust. Streamline your task management workflow directly from your terminal.
Installation • Features • Setup Guide • Usage • Contributing
This project relies on the following major dependencies:
For development:
📝 Task Creation
|
📊 Task Management
|
🔍 Advanced Filtering
|
⚡ Quick Actions
|
cargo install notion-cli-rs
git clone https://github.com/CharlonTank/notion-cli-rs.git
cd notion-cli-rs
cargo install --path .
curl -sSL https://raw.githubusercontent.com/CharlonTank/notion-cli-rs/master/install.sh | bash
# Create local bin directory if it doesn't exist
mkdir -p ~/.local/bin
# Copy the binary
cp target/release/notion-cli-rs ~/.local/bin/
# Add to PATH in your shell's configuration file:
# For Bash (add to ~/.bashrc or ~/.bash_profile)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# For Zsh (add to ~/.zshrc)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# For Fish (recommended way)
fish_add_path ~/.local/bin
# Requires sudo privileges
sudo cp target/release/notion-cli-rs /usr/local/bin/
# Create a directory for the binary
mkdir -p "$env:USERPROFILE\bin"
# Copy the binary
copy "target\release\notion-cli-rs.exe" "$env:USERPROFILE\bin"
# Add to PATH in PowerShell (current session)
$env:PATH += ";$env:USERPROFILE\bin"
# Add to PATH permanently (run in PowerShell as Administrator)
[Environment]::SetEnvironmentVariable(
"Path",
[Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\bin",
"User"
)
# Install Scoop if not already installed
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
# Create and switch to a new directory for the package
mkdir ~/.scoop/apps/notion-cli-rs
cd ~/.scoop/apps/notion-cli-rs
# Copy the binary
copy "target\release\notion-cli-rs.exe" "notion-cli-rs.exe"
# Add to Scoop's shims
scoop shim add notion-cli-rs
After installation, verify the CLI is properly installed:
notion-cli-rs --help
Create a database with these properties:
| Property | Type | Options |
|---|---|---|
| Name | Title | - |
| Status | Select | Not started, In progress, Done |
| Priority | Select | High, Medium, Low |
| Due Date | Date | - |
| Tags | Multi-select | Custom tags |
| Description | Text | - |
cp .env.example .env
NOTION_TOKEN=secret_your_integration_token_here
NOTION_DATABASE_ID=your_database_id_here
LOCAL_TIMEZONE=America/New_York
# Create a task
notion-cli-rs add "Deploy new feature" \
--priority high \
--due "2024-01-20" \
--tags "dev,feature" \
--description "Deploy the new authentication system"
# List tasks
notion-cli-rs list
# Update status
notion-cli-rs status <task-id> "in progress"
# Add a simple task
notion-cli-rs add "Buy groceries"
# Add a detailed task
notion-cli-rs add "Quarterly report" \
--priority high \
--due "2024-01-20" \
--tags "work,reports,q4" \
--description "Prepare Q4 2023 financial report for stakeholders"
# List all tasks
notion-cli-rs list
# List tasks with filters
notion-cli-rs list --status "in progress" --priority high
# Update task status
notion-cli-rs status <task-id> "in progress"
notion-cli-rs status <task-id> "done"
# Delete a task
notion-cli-rs delete <task-id>
# Set/update task priority
notion-cli-rs priority <task-id> high
# Set/update due date
notion-cli-rs due-date <task-id> "2024-01-20"
# Add/update tags
notion-cli-rs tags <task-id> "urgent,priority,q4"
# Set/update description
notion-cli-rs description <task-id> "Detailed task description here"
# List high priority tasks
notion-cli-rs list --priority high
# List in-progress tasks
notion-cli-rs list --status "in progress"
# List tasks with specific tag
notion-cli-rs list --tag work
# List tasks sorted by due date
notion-cli-rs list --sort-by-due
# Show general help
notion-cli-rs --help
# Show help for specific command
notion-cli-rs add --help
notion-cli-rs list --help
# etc.
| Status | Symbol | | Priority | Symbol | |--------|--------||-|----------|--------| | Not Started | ⭕ | | High | 🔴 | | In Progress | 🔄 | | Medium | 🟡 | | Done | ✅ | | Low | 🟢 |
Authentication Error:
NOTION_TOKEN in .envsecret_Database Not Found:
NOTION_DATABASE_ID in .envCommand Not Found:
cargo run -- <command> instead of direct binary callscargo runInvalid Property Values:
# Show general help
notion-cli-rs --help
# Show help for specific command
notion-cli-rs add --help
notion-cli-rs list --help
# etc.
cargo test # Run all tests
cargo test -- --nocapture # With output
cargo build --release
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by CharlonTank
notion-cli-rs/
├── src/
│ ├── main.rs # CLI entry point and command handling
│ ├── lib.rs # Library interface
│ ├── notion.rs # Notion API client implementation
│ └── config.rs # Configuration management
├── tests/
│ └── integration_tests.rs # Integration tests
├── .env.example # Environment variables template
├── Cargo.toml # Project dependencies
└── install.sh # Installation script
This CLI uses the Notion API v2022-06-28. For detailed API documentation, visit:
Key API endpoints used:
POST /v1/pages: Create new tasksPATCH /v1/pages/{id}: Update task propertiesPOST /v1/databases/{id}/query: List and filter tasksgit clone https://github.com/CharlonTank/notion-cli-rs.git
cd notion-cli-rs
cargo build
cp .env.example .env
# Edit .env with your test credentials
# Unit tests
cargo test
# Integration tests (requires .env setup)
cargo test -- --test integration_tests
# With logging
RUST_LOG=debug cargo test -- --nocapture
cargo fmt before committingcargo clippy for linting| Error Code | Description | Solution |
|---|---|---|
| 401 | Unauthorized | Check your NOTION_TOKEN |
| 404 | Not Found | Verify database/page IDs |
| 409 | Conflict | Check for duplicate operations |
| 429 | Rate Limited | Implement backoff strategy |
Error: NOTION_TOKEN environment variable not set
Solution: Ensure .env file exists and contains valid token
Error: Could not access database
Solution: Check integration permissions and connection
Error: Invalid task status
Solution: Use exact status values: "Not started", "In progress", "Done"
Enable debug logging:
RUST_LOG=debug notion-cli-rs list
Common debug flags:
RUST_LOG=debug: Detailed loggingRUST_BACKTRACE=1: Full error backtracesNOTION_API_URL: Override API endpoint (testing)