navi icon indicating copy to clipboard operation
navi copied to clipboard

Confusion regarding paths and other things

Open typkrft opened this issue 3 years ago • 8 comments

First I wanted to say thank you for the utility. It's very helpful. I just wanted to mention a few points of confusion I had when using navi.

In the program if you run navi info config-path even after you set $NAVI_CONFIG it will still display /Users/USERNAME/Library/Application Support/navi/config.yaml That's kind of confusing, maybe I missed something, but I was just assuming it wasn't working.

Secondly, when you select edit config it defaults to /Users/USERNAME/Library/Application Support/navi/config.yaml instead of the $NAVI_CONFIG env variable that was set. It may be nice to check to see if the env is set and use that instead.

Third, macOS is unix compliant, it would be nice to see the default paths in the $HOME/.config directory. This would bring it more inline with other dotfiles that most people maintain.

Obviously these are just opinions. I'd like to reiterate my gratitude, I was about to make a less robust shell version of this before I found it.

typkrft avatar Dec 31 '21 01:12 typkrft

Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)

welcome[bot] avatar Dec 31 '21 01:12 welcome[bot]

Just installed on Arch and it seems to work as I expected it to lol. I guess it's a bug on macOS then?

typkrft avatar Dec 31 '21 10:12 typkrft

navi info config-path

Actually that was intentional, but I agree the name is misleading. It should be navi info default-config-path

When I implemented this command, the idea was to provide a way for users to know which config path is set by default, as this isn't set by the user and is tricky to get it figured out

denisidoro avatar Jan 04 '22 11:01 denisidoro

edit config

I'm not sure I follow. What do you mean by this?

denisidoro avatar Jan 04 '22 11:01 denisidoro

$HOME/.config

Actually, I'm using the https://crates.io/crates/directories-next library for handling these paths.

It selects the most idiomatic path for each OS. In case of Linux it's ~/.config. In case of OSX it's .../Library/...

I don't have the full historic background on this but I think navi should follow whatever directories-next determines

denisidoro avatar Jan 04 '22 11:01 denisidoro

edit config

I'm not sure I follow. What do you mean by this?

I believe when you first open navi or maybe if it doesn't find a cheat there's an option to edit the config and even though I had the ENV set it still didn't use the config set. If that doesn't make sense I'll play around and get a screenshot.

I obviously am not going to argue with your choice on a default path as long as it can be changed it's not really a big deal. Even apple recommends using Library in their documentation for File System Programming. That being said macOS is fully unix compliant and certified as such. Neovim, Ranger, bat, kitty, pandoc, starship, etc all use unix compliant Well Known Dirs. By default macOS also keeps it's zshrc, bashrc, profiles, history, etc in the home directory and not somewhere in the library which also fit the description in the documentation for files that should be put in ~/Library. I think most people who work in terminal on macOS will likely look there first ootb. I also think it's convenient when deploying dotfiles between platforms. But again it's no big deal.

typkrft avatar Jan 04 '22 15:01 typkrft

So I think what initially happened was I generated the default config moved it ~/.config/navi then opening navi for the first time I came to the screen below this fell back to the ~/Library/Application\ Support/navi path instead of using the config generated by me and despite export NAVI_CONFIG="$HOME/.config/navi/config.yaml" being set in my .zshrc. That would be the only thing to maybe look into, everything else is a matter of opinion.

Screen Shot 2022-01-04 at 7 55 36 PM Screen Shot 2022-01-04 at 7 55 38 PM

typkrft avatar Jan 05 '22 01:01 typkrft

Is this still active..? I haven't found documentation for env variables, and had a quick stab at setting a few from here, but to no avail.

I think the OS directory idioms set by the Rust team are strongly related to building full GUI apps for the masses. In the case of a CLI tool, which is certainly going to be used by developers and CLI users alike, there should be an option to set a custom data dir.

For me setting NAVI_CONFIG worked. But am still looking how to set a custom data dir for the cheat sheet repos

tjex avatar Nov 03 '23 14:11 tjex