Related with #116
os.UserConfigDir() docs:
On Unix systems, it returns $XDG_CONFIG_HOME as specified by https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.config. On Darwin, it returns $HOME/Library/Application Support. On Windows, it returns %AppData%. On Plan 9, it returns $home/lib.
Currently .wegorc defaults to $HOME/.wegorc in all systems. I'm proposing this logic for searching/creating the config file:
$WEGORC takes the highest precedence.
- If
$WEGORC is not set, try to open the config file from os.UserConfigDir()/wego/wegorc (can adjust the name, but the point is it is stored inside os.UserConfigDir)
- If the config file is not found, fallback try to open the config file from
$HOME/.wegorc for backward compatibility
- If still now found, generate the config file
- in
$WEGORC if it is set
- else, generate the file in
os.UserConfigDir()/wego/wegorc
Related with #116
os.UserConfigDir() docs:
Currently .wegorc defaults to $HOME/.wegorc in all systems. I'm proposing this logic for searching/creating the config file:
$WEGORCtakes the highest precedence.$WEGORCis not set, try to open the config file fromos.UserConfigDir()/wego/wegorc(can adjust the name, but the point is it is stored inside os.UserConfigDir)$HOME/.wegorcfor backward compatibility$WEGORCif it is setos.UserConfigDir()/wego/wegorc