feat: Add Onyx CLI tool source, tests, and PyInstaller build configuration.

This commit is contained in:
olivier committed 2025-11-20 19:49:16 -05:00
1 parent bf1dca3bc4
commit e498031f10
38 files changed
+43760 -77

No files matched your search

+48 -37
View File
@@ -1,7 +1,18 @@
# Onyx CLI - Obsidian Command Line Tool
# Onyx CLI
A Python-based command-line interface for interacting with Obsidian vaults. Manage notes directly from the terminal without opening Obsidian.
## Building the Windows Executable (.exe)
You can build a standalone Windows executable using PyInstaller:
```bash
pip install pyinstaller
pyinstaller --onefile --name onyx src/onyx.py
```
The resulting `onyx.exe` will be found in the `dist` folder.
## Installation
1. Clone this repository
@@ -14,14 +25,14 @@ pip install -r requirements.txt
Set up your default vault:
```bash
ob-cli set-default "my-vault" --path "/path/to/vault"
onyx set-default "my-vault" --path "/path/to/vault"
```
Then use any command:
```bash
ob-cli open "note-name"
ob-cli daily
ob-cli frontmatter "note-name" --view --key "tags"
onyx open "note-name"
onyx daily
onyx frontmatter "note-name" --view --key "tags"
```
## Commands
@@ -30,90 +41,90 @@ ob-cli frontmatter "note-name" --view --key "tags"
```bash
# Set default vault (required first time)
ob-cli set-default "vault-name" --path "/path/to/vault"
onyx set-default "vault-name" --path "/path/to/vault"
# Print current default vault
ob-cli print-default
onyx print-default
```
### Opening Notes
```bash
# Open a note in Obsidian
ob-cli open "note-name"
onyx open "note-name"
# Open note from specific vault
ob-cli open "note-name" --vault "vault-name"
onyx open "note-name" --vault "vault-name"
```
### Periodic Notes
```bash
# Create or open today's daily note
ob-cli daily
onyx daily
# Create or open this week's note
ob-cli weekly
onyx weekly
# Create or open this month's note
ob-cli monthly
onyx monthly
# Create or open this quarter's note
ob-cli quarterly
onyx quarterly
# Create or open this year's note
ob-cli yearly
onyx yearly
```
### Creating & Editing Notes
```bash
# Create a new note
ob-cli create "note-name"
onyx create "note-name"
# Create with content
ob-cli create "note-name" --content "Your content here"
onyx create "note-name" --content "Your content here"
# Create in specific vault
ob-cli create "note-name" --vault "vault-name"
onyx create "note-name" --vault "vault-name"
# Overwrite existing note
ob-cli create "note-name" --content "New content" --overwrite
onyx create "note-name" --content "New content" --overwrite
# Append to existing note
ob-cli create "note-name" --content "Additional content" --append
onyx create "note-name" --content "Additional content" --append
# Create and open
ob-cli create "note-name" --content "content" --open
onyx create "note-name" --content "content" --open
```
### Viewing Notes
```bash
# Print note contents to terminal
ob-cli print-note "note-name"
onyx print-note "note-name"
# Print from specific vault
ob-cli print-note "note-name" --vault "vault-name"
onyx print-note "note-name" --vault "vault-name"
```
### Moving & Deleting Notes
```bash
# Move or rename a note (auto-updates internal links)
ob-cli move "old-path" "new-path"
onyx move "old-path" "new-path"
# Move in specific vault
ob-cli move "old-path" "new-path" --vault "vault-name"
onyx move "old-path" "new-path" --vault "vault-name"
# Move and open
ob-cli move "old-path" "new-path" --open
onyx move "old-path" "new-path" --open
# Delete a note
ob-cli delete "note-path"
onyx delete "note-path"
# Delete from specific vault
ob-cli delete "note-path" --vault "vault-name"
onyx delete "note-path" --vault "vault-name"
```
### Frontmatter Management
@@ -122,30 +133,30 @@ Edit note metadata in YAML frontmatter:
```bash
# View a frontmatter key
ob-cli frontmatter "note-name" --view --key "tags"
onyx frontmatter "note-name" --view --key "tags"
# Check if a value exists in frontmatter
ob-cli frontmatter "note-name" --view --key "tags" --value "project"
onyx frontmatter "note-name" --view --key "tags" --value "project"
# Edit frontmatter (add or update key)
ob-cli frontmatter "note-name" --edit --key "tags" --value "project"
ob-cli frontmatter "note-name" --edit --key "tags" --value "project,urgent"
ob-cli frontmatter "note-name" --edit --key "status" --value "in-progress"
onyx frontmatter "note-name" --edit --key "tags" --value "project"
onyx frontmatter "note-name" --edit --key "tags" --value "project,urgent"
onyx frontmatter "note-name" --edit --key "status" --value "in-progress"
# Clear frontmatter values
ob-cli frontmatter "note-name" --clear --key "tags"
ob-cli frontmatter "note-name" --clear --key "date,status,tags"
onyx frontmatter "note-name" --clear --key "tags"
onyx frontmatter "note-name" --clear --key "date,status,tags"
# Delete frontmatter keys
ob-cli frontmatter "note-name" --delete --key "tags"
ob-cli frontmatter "note-name" --delete --key "date,status,tags"
onyx frontmatter "note-name" --delete --key "tags"
onyx frontmatter "note-name" --delete --key "date,status,tags"
```
### Version
```bash
# Display version
ob-cli --version
onyx --version
```
## Features