phibr0 / obsidian-open-with

MIT License
35 stars 3 forks source link

Extra empty argument is passed #10

Open huyz opened 2 years ago

huyz commented 2 years ago

If I'm trying to launch /Applications/MacVim.app/Contents/MacOS/MacVim, what gets invoked is:

open -a "/Applications/MacVim.app/Contents/MacOS/MacVim" "/Users/huyz/Documents/Vaults/Vault/Obsidian playground.md" --args ""

The extra blank argument "" makes an empty window be opened too.

So I guess this is a bug and blank arguments should not be passed at all.

akhiljalagam commented 11 months ago

I've encountered the same issue. An additional empty argument is being passed and there are also problems with quotation marks. I have found a workaround for this problem by using this script on a Linux system.

#!/bin/bash

for arg in "$@"; do
  if [[ "$arg" != '' ]]; then
    args="$arg"
  fi
done

xdg-open "$args"
jasonish commented 10 months ago

If hitting this typing to open files with emacs, just add --visit as an extra argument.