pimterry / notes

:pencil: Simple delightful note taking, with more unix and less lock-in.
https://github.com/pimterry/notes
MIT License
1.24k stars 82 forks source link

Notes open does not cd to notes directory #92

Closed cybercoder-naj closed 6 months ago

cybercoder-naj commented 7 months ago

Issue Summary

The documentation as well as the --help command specify that using notes open|o would open my notes directory. But it does not.

Steps to Reproduce

  1. Install notes
  2. Specify your notes directory
  3. Enter notes o

After these steps, this is the output of the script: /usr/local/bin/notes: line 232: open: command not found

Technical details:

pimterry commented 6 months ago

This is the current design, yes, but I can see how that could be confusing here...

The intent is that the directory is opened in your default handler for directories (i.e. a file manager) rather than cd-ing directly. We assume that open (a very-common-but-not-actually-standard alias for xdg-open) is available to do this.

Do you have xdg-open on your machine? Do you have an open alias to it?

I think:

Would that work for you? PRs welcome!

cybercoder-naj commented 6 months ago

In my .zshrc, I do have an alias open=xdg-open. However, running the script still results in an error open command not found.

A possible reason is may be since I am on ZSH, and the script is in #!/usr/bin/env bash, it does not recognise any of the zsh aliases on my machine.

I think your solution for checking for xdg-open > open in preference is the best way to approach using the open command. However, I think notes open should not default to cd as I may simply want to change directories in the terminal and not use a different application to open $NOTESDIR. notes cd seems like a great command.

pimterry commented 6 months ago

Ah, that makes sense, yes if this is a zsh-only alias you'll run into problems. Of course you could quickly fix this by setting that alias more widely instead :smile:.

But I do thing it would be nice to improve this anyway to avoid that. If you're interested in implementing some or all of the ideas above, please open a PR. Let me know if you have any questions about that at all.