obsidian-cli icon indicating copy to clipboard operation
obsidian-cli copied to clipboard

Print command to use path from vault (or name as currently implemented)

Open danielwerg opened this issue 10 months ago • 3 comments
trafficstars

Describe the bug

Had issues with newlines and nested notes

To Reproduce

  1. obsidian-cli create "nested/test" --append --content "hello"

  2. Creates a nested note "nested/test" with "hello" for content

  3. Repeat step 1

  4. Adds 2 newlines

  5. obsidian-cli print "nested/test"

  6. 2024/12/28 11:11:08 Cannot find note in vault

Expected behavior

Don't insert newlines unless user specifies

Don't fail on printing nested notes

danielwerg avatar Dec 28 '24 11:12 danielwerg

Thanks for the feedback @danielwerg. You are mentioning 2 bugs that I can see:

  1. Creating new note with appending creates 2 new lines - This does not seem to be a bug as when I use the Obsidian URI directly open obsidian://new?vault=vault-name&name=test&content=hello&append, its the same result. This is how the implementation is working from Obsidian URI so not something I would be able to change. Note this has nothing to do with being nested or not nested (just mentioning as your example mentioned nested notes but it doesnt seem to be relevent to the issue)
  2. Good spot, the new print command does not currently support vault paths, its working based on note name. If this is useful I can do this as a feature request soon. Note you can still do obsidian-cli print test to print nested/test (assuming this is the only note or the first note called test). This is what I tend to do as do not have many duplicate note names.

Yakitrak avatar Dec 29 '24 11:12 Yakitrak

Yeah, I have several duplicated notes named "TODO" :D

For 1. I guess I will have to use print and create without --append and composing new note myself. Because I'm trying to append new item to the markdown list.

danielwerg avatar Dec 29 '24 14:12 danielwerg

Ah I see, yeah unfortunately if that is how Obsidan URI's work then you will need to use this work around when adding to a note.

In terms of the print command, I will add path functionality in the future.

Yakitrak avatar Dec 29 '24 15:12 Yakitrak

Closed with https://github.com/Yakitrak/obsidian-cli/pull/50. Will release new version now.

Yakitrak avatar Aug 18 '25 15:08 Yakitrak