Skip to main content

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 and path, 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

  1. Clone the Repository

    git clone https://github.com/guglielmo/obsidian_note_cli.git
    cd obsidian_note_cli
    
  2. 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 variable VAULT).
  • --path: Path within the vault to save the note (default can be set via environment variable PATH).
  • --tags: Comma-separated list of tags.
  • --status: Optional status for the note.
  • --created_at: Date in YYYY-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

  1. Create a Basic Note

    obsidian-note --title "Daily Log" --vault "WorkVault" --path "Logs" --tags "daily,log" --status "in-progress"
    
  2. Create a Note with Interactive Mode

    obsidian-note --interactively
    
  3. Pipe Content into a Note

    echo "This is piped content" | obsidian-note --title "Piped Note" --vault "MyVault" --path "Notes" --tags "example,pipe"
    
  4. 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:

  1. Clone the repository and navigate into it:

    git clone https://github.com/yourusername/obsidian_note_cli.git
    cd obsidian_note_cli
    
  2. Install dependencies using poetry:

    poetry install
    
  3. 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.

Metadata

Release files for obsidian_note_cli 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obsidian_note_cli 0.1.5
File Size Uploaded Provenance
obsidian_note_cli-0.1.5.tar.gz 5.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for obsidian_note_cli 0.1.5
File Interpreter ABI Platform
obsidian_note_cli-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / obsidian_note_cli-0.1.5.tar.gz

Download URL obsidian_note_cli-0.1.5.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
68b0f44ba59c4aef999aa924ccfa1828c9b940503567992f853568a35ae44d30
BLAKE2b-256 checksum
How to use checksums
5a1e85b2ca533a84f4171c4cdc31ae5023abe18023dc782967c4fcafb4635ff0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.2 Linux/6.9.2-060902-generic

Release files / obsidian_note_cli-0.1.5-py3-none-any.whl

Download URL obsidian_note_cli-0.1.5-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
feae4148055a45743058104ce38b0701c4781eba65024e1216f6ec7d5c392e9c
BLAKE2b-256 checksum
How to use checksums
1b09ff107586269c1ddc9102554a07aabbe99dc9cef60c72dc8a6e581c698638
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.2 Linux/6.9.2-060902-generic

Security for obsidian_note_cli 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page