CLI behaviour is inconsistent

The current CLI behaviour is inconsistent, making reliable automated scripting almost impossible. The problem is that the outcome of a call to the obsidian CLI depends on whether the GUI is currently running (I’ve tested this on Mac only, by the way). Furthermore, there seems to be no reliable way to check whether the GUI is currently running.

Example:

obsidian vaults

When the obsidian GUI is running, this returns with a list of vaults. When the GUI is not running, this does NOT return but instead runs the GUI. It would probably be better to exit with an error so this can be properly handled.

It would be even better if we could write something along the lines of

if ! obsidian running; then

obsidian &

fi

Although in my opinion the command for starting the GUI should be a completely separate executable from the cli, e.g. “obsidian” vs “obsidian-cli”

2 Likes

yes, this is how it works, not a bug. Moved to the help section.

there may be changes in how the cli works in v1.12.5. So hold on creating a FR until then.

At the very least, it would be useful to just have a command to check if obsidian is already running without starting it.

I seem to have some issues with launching the GUI from terminal, not entirely sure what the issue is. I want to have an LLM interact with the vault. There’s no issue if I already have the Obsidian GUI running, but it would be convenient if the LLM could first run obsidian --running or some thing similar and ask me to open the GUI if it is not running.

My situation may be a bit niche, but I think having a straightforward way to check if the GUI is currently running from commandline without doing anything else could be a simple feature that might be useful to different people for different reasons.