antfu-collective / ni

💡 Use the right package manager
MIT License
6.25k stars 208 forks source link

Support load config in ~/.config/.nirc #195

Closed CoolPlayLin closed 7 months ago

CoolPlayLin commented 9 months ago

Clear and concise description of the problem

As a user, I'd like every CLI's config file can put in a folder like ~/.config instead of putting on user's root folder. It would make my root folder mess and inconvenient to manage.

Suggested solution

Currently, ni only read config in ~/ . I hope that you could path in ~/.config

Alternative

No response

Additional context

No response

Validations

HawtinZeng commented 9 months ago

Hi, bro, I have found a way to automatically read nirc file from the custom path, just use Environment Variable, If your machine is based on windows, you can follow this blog.https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.4

kitschpatrol commented 8 months ago

I think based on the readme, you can "just" add this to your shell rc to use a custom configuration file path?

# ~/.bashrc

# custom configuration file path
export NI_CONFIG_FILE="$HOME/.config/ni/nirc"