CLI tool to save well-structured notes in Obsidian format
Project description
Obsidian Note CLI
obsidian_note_cli
is a command-line tool for creating well-structured notes in Obsidian, complete with front matter metadata like creation date, tags, and status. This tool is designed for users who frequently take notes and want to streamline their note-taking workflow using Obsidian and the command line.
It goes well along with Daniel Miessler's Fabric, as it processes content passed through the stdin as default.
Features
- Create notes with customizable front matter fields:
created_at
,tags
,status
,source
, and more. - Specify note content via a file or piped input (Linux-style
stdout | stdin
). - Set default values for
created_at
at today's date. - Configuration via environment variables for
vault
andpath
, with sensible defaults
Installation
Prerequisites
- Python 3.8 or higher
- Poetry for managing dependencies and packaging (optional but recommended)
- pipx for globally installing CLI tools
Step-by-Step Installation
-
Clone the Repository
git clone https://github.com/guglielmo/obsidian_note_cli.git cd obsidian_note_cli
-
Build the Package with Poetry
poetry build
Step 3: Install with pipx
Ensure that pipx
is installed on your system. Then, use pipx
to install the latest version of the CLI tool globally:
pipx install dist/obsidian_note_cli-<VERSION>-py3-none-any.whl
Replace with the latest version of your package (e.g., 0.1.0).
To check the current version, refer to the version specified in the pyproject.toml file or check the release information in your repository if published.
This makes obsidian-note
available as a command globally, isolated from other Python environments.
Alternatively, if you are frequently updating and testing new versions, you can specify a specific version or install directly from your local directory after building:
pipx install dist/obsidian_note_cli-$(poetry version -s)-py3-none-any.whl
This command dynamically uses the current version from pyproject.toml by extracting it with poetry version -s.
Usage
Basic Usage
To create a note, specify at least the title, vault, and tags:
obsidian-note --title "My First Note" --vault "MyVault" --path "Notes" --tags "tag1,tag2"
This command saves a note in the specified vault and path with the provided title and tags.
Using Interactive Mode
To enter parameters interactively, use the --interactively
flag:
obsidian-note --interactively
Example with Piped Content
You can pipe content into obsidian-note
:
echo "This is the note content" | obsidian-note --title "My Piped Note" --vault "MyVault" --path "Notes" --tags "piped,content"
Options
--title
: Title of the note.--vault
: Obsidian vault name (default can be set via environment variableVAULT
).--path
: Path within the vault to save the note (default can be set via environment variablePATH
).--tags
: Comma-separated list of tags.--status
: Optional status for the note.--created_at
: Date inYYYY-MM-DD
format (defaults to today).--interactively
: Flag to enter parameters interactively.content
: The content of the note, provided via a file or stdin.
Configuration via Environment Variables
You can set default values for vault
and path
using environment variables:
export OBSIDIAN_VAULT="MyVault"
export OBSIDIAN_PATH="Notes"
This configuration allows you to avoid specifying --vault
and --path
for each note.
Examples
-
Create a Basic Note
obsidian-note --title "Daily Log" --vault "WorkVault" --path "Logs" --tags "daily,log" --status "in-progress"
-
Create a Note with Interactive Mode
obsidian-note --interactively
-
Pipe Content into a Note
echo "This is piped content" | obsidian-note --title "Piped Note" --vault "MyVault" --path "Notes" --tags "example,pipe"
-
Use with fabric
fabric -u https://zettelkasten.de/introduction/ | summarize | \ obsidian-note --path="09.ReadingList" --source=https://zettelkasten.de/introduction/
This is a bit awkward, as for the duplication of the URL, an idea would be to define a bash function:
function process_note_summarize() { local url="$1" fabric -u "$url" | summarize | \ obsidian-note --source="$url" "$@" }
so that the whole process of reducing the content of the URL to markdown, summarizing it through the AI and sending it to Obsidian, at a specific folder of the default vault, could be expressed as:
process_note_summarize "https://zettelkasten.de/introduction/" \ --path 09.ReadingList --tags self_improvement formation
Development
If you want to modify the tool, follow these steps to set up a development environment:
-
Clone the repository and navigate into it:
git clone https://github.com/yourusername/obsidian_note_cli.git cd obsidian_note_cli
-
Install dependencies using
poetry
:poetry install
-
Run the tool locally with
poetry
:poetry run obsidian-note --title "Test Note" --vault "TestVault" --path "TestPath" --tags "test"
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributing
Contributions are welcome! Please feel free to open issues or submit pull requests.
Contact
For questions or suggestions, please contact guglielmo.celata@example.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file obsidian_note_cli-0.1.5.tar.gz
.
File metadata
- Download URL: obsidian_note_cli-0.1.5.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.2 Linux/6.9.2-060902-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68b0f44ba59c4aef999aa924ccfa1828c9b940503567992f853568a35ae44d30 |
|
MD5 | 7fa45b2daf3348ae22b309507f0a3e43 |
|
BLAKE2b-256 | 5a1e85b2ca533a84f4171c4cdc31ae5023abe18023dc782967c4fcafb4635ff0 |
File details
Details for the file obsidian_note_cli-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: obsidian_note_cli-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.2 Linux/6.9.2-060902-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | feae4148055a45743058104ce38b0701c4781eba65024e1216f6ec7d5c392e9c |
|
MD5 | 9c433df2dff3f830d0767ca1b184f818 |
|
BLAKE2b-256 | 1b09ff107586269c1ddc9102554a07aabbe99dc9cef60c72dc8a6e581c698638 |