initial
This commit is contained in:
commit
3d122b5022
8 files changed
+1065
No files matched your search
@@ -0,0 +1,168 @@
|
||||
# Onyx Python Helper
|
||||
|
||||
A Python-based command-line interface tool for interacting with Obsidian vaults. This tool allows you to manage your Obsidian notes directly from the terminal.
|
||||
|
||||
## Installation
|
||||
|
||||
1. Clone this repository
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Set Default Vault
|
||||
|
||||
First, you need to set up your vault with both its name and path:
|
||||
|
||||
```bash
|
||||
# Set up a new vault with its path (required for first use)
|
||||
ob-cli set-default "vault-name" --path "/path/to/vault"
|
||||
|
||||
# Print current default vault and its path
|
||||
ob-cli print-default
|
||||
|
||||
# Switch to another existing vault (only works for already configured vaults)
|
||||
ob-cli set-default "another-vault"
|
||||
```
|
||||
|
||||
### Open Notes
|
||||
|
||||
```bash
|
||||
# Open a note in Obsidian
|
||||
python src/obsidian_cli.py open "note-name"
|
||||
|
||||
# Open a note in specific vault
|
||||
python src/obsidian_cli.py open "note-name" --vault "vault-name"
|
||||
```
|
||||
|
||||
### Daily Notes
|
||||
|
||||
```bash
|
||||
# Create and open today's daily note
|
||||
python src/obsidian_cli.py daily
|
||||
|
||||
# Create daily note in specific vault
|
||||
python src/obsidian_cli.py daily --vault "vault-name"
|
||||
```
|
||||
|
||||
### Create/Update Notes
|
||||
|
||||
```bash
|
||||
# Create a new note
|
||||
python src/obsidian_cli.py create "note-name"
|
||||
|
||||
# Create note with content
|
||||
python src/obsidian_cli.py create "note-name" --content "Your content here"
|
||||
|
||||
# Create note in specific vault
|
||||
python src/obsidian_cli.py create "note-name" --vault "vault-name"
|
||||
|
||||
# Overwrite existing note
|
||||
python src/obsidian_cli.py create "note-name" --content "New content" --overwrite
|
||||
|
||||
# Append to existing note
|
||||
python src/obsidian_cli.py create "note-name" --content "Additional content" --append
|
||||
|
||||
# Create and open note
|
||||
python src/obsidian_cli.py create "note-name" --content "content" --open
|
||||
```
|
||||
|
||||
### View Notes
|
||||
|
||||
```bash
|
||||
# Print note contents
|
||||
python src/obsidian_cli.py print-note "note-name"
|
||||
|
||||
# Print note from specific vault
|
||||
python src/obsidian_cli.py print-note "note-name" --vault "vault-name"
|
||||
```
|
||||
|
||||
### Move/Rename Notes
|
||||
|
||||
```bash
|
||||
# Move/rename a note
|
||||
python src/obsidian_cli.py move "old-path" "new-path"
|
||||
|
||||
# Move in specific vault
|
||||
python src/obsidian_cli.py move "old-path" "new-path" --vault "vault-name"
|
||||
|
||||
# Move and open note
|
||||
python src/obsidian_cli.py move "old-path" "new-path" --open
|
||||
```
|
||||
|
||||
### Delete Notes
|
||||
|
||||
```bash
|
||||
# Delete a note
|
||||
python src/obsidian_cli.py delete "note-path"
|
||||
|
||||
# Delete from specific vault
|
||||
python src/obsidian_cli.py delete "note-path" --vault "vault-name"
|
||||
```
|
||||
|
||||
### Frontmatter Management
|
||||
|
||||
```bash
|
||||
# Edit frontmatter
|
||||
python src/obsidian_cli.py frontmatter "note-name" --edit --key "tags" --value "project"
|
||||
python src/obsidian_cli.py frontmatter "note-name" --edit --key "tags" --value "project,urgent"
|
||||
python src/obsidian_cli.py frontmatter "note-name" --edit --key "status" --value "in-progress"
|
||||
|
||||
# View frontmatter
|
||||
python src/obsidian_cli.py frontmatter "note-name" --view --key "tags"
|
||||
python src/obsidian_cli.py frontmatter "note-name" --view --key "tags" --value "project"
|
||||
|
||||
# Clear frontmatter values
|
||||
python src/obsidian_cli.py frontmatter "note-name" --clear --key "tags"
|
||||
python src/obsidian_cli.py frontmatter "note-name" --clear --key "date,status,tags"
|
||||
|
||||
# Delete frontmatter keys
|
||||
python src/obsidian_cli.py frontmatter "note-name" --delete --key "tags"
|
||||
python src/obsidian_cli.py frontmatter "note-name" --delete --key "date,status,tags"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
The tool now includes all major features from the original Obsidian CLI tool:
|
||||
- Set and manage default vault
|
||||
- Open notes in Obsidian
|
||||
- Create and manage daily notes
|
||||
- Create/update notes with content
|
||||
- Print note contents
|
||||
- Move/rename notes (with automatic link updates)
|
||||
- Delete notes
|
||||
- Complete frontmatter management (edit, view, clear, delete)
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.7+
|
||||
- click
|
||||
- pyyaml
|
||||
|
||||
## Development
|
||||
|
||||
### Running Tests
|
||||
|
||||
To run the tests:
|
||||
|
||||
```bash
|
||||
# Install test dependencies
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Run tests
|
||||
python -m pytest
|
||||
|
||||
# Run tests with coverage report
|
||||
python -m pytest --cov=src tests/
|
||||
```
|
||||
|
||||
The test suite includes tests for:
|
||||
- Vault management
|
||||
- Note creation and modification
|
||||
- Frontmatter operations
|
||||
- Note movement and link updates
|
||||
- Daily notes
|
||||
- Platform-specific note opening
|
||||
- Note deletion
|
||||
Reference in new issue
Block a user