-
Notifications
You must be signed in to change notification settings - Fork 73
ZON Configuration #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
ZON Configuration #168
Conversation
|
Okay! It seems that 0.14.0 has been released, and so we should now start having another look at this PR. The last things to do on this are:
I've rebased this back onto the tip of master, and so can start getting this to a mergeable state any time. |
|
|
This seems like the way to do it. I've added a commit to use this on Windows platforms. I've just done a rudimentary test on Windows. The config file ends up being at path I've also bumped up the commits here and rebased them onto the tip of master, which included shuffling the XDG_HOME stuff into the All that being said, this should be ready for review now. |
f407adb to
90a5af9
Compare
|
Okay, realized there was some overlap between the |
4c310d4 to
1b2a13e
Compare
|
With the removal of |
3a085c3 to
e669728
Compare
This struct contains the configuration for Zigup. A global object `config` is initialized from command-line arguments and from reading in a ZON file. Its ensured that command-line arguments always overwrite ZON file values, and if neither are set then the default value is used. A global (`zigup.config`) is used for storing the final configuration because its pretty universal and gets used all over the place. Its expected that this value gets initialized once, before we start doing any serious work, and is never mutated again. Some shuffling around of the parsing was needed to be done, notably the check for the `run` command was moved after configuration is initialized. The `getInstallDir` and `makeZigPathLinkString` have been moved and renamed as functions within Config, and functions using those instead read from `zigup.config` directly. This has an added benefit of removing some allocations.
Tilde paths (e.g. '~/.local/bin') were not expanding properly.
b2df1ea to
0e571ab
Compare
This fixes a couple visual bugs in printing, where some paths will have a double path separator if one was left trailing in configuration.
|
Did a couple tweaks to the PR here but it should be good for review now |
|
Apologies for taking a while to respond. I was thinking about this and going through the readme and had an idea that might make this a bit simpler? I think there's probably only 1, maybe 2 options that zigup users may want to customize via a config file, the "install directory" being the main one. What if instead of a ZON config file that supports setting multiple options, we just have a single optional file for this one option? Also, since there is already an This seems like a simpler overall solution to me. We could always enhance this configuration to ZON later though if we add more options? What do you think? |
|
FYI, I went ahead and implemented this as a command-line controlled setting for now in this commit: 3de4c86, i.e. It feels a bit simpler for the user to have to learn/manage I think. |
|
That is a whole lot simpler for the end user, I agree. I think the only thing missing is a similar way to set the path link |
I've implemented the ZON configuration file system as discussed in #146.
A couple of important points before this can be merged:1) This does not build with Zig 0.13.0, as it relies onstd.zonfor parsing and serializing the ZON file. If we want to keep zigup pinned to a release instead of master we should wait until 0.14.0 is out, which hopefully wont be too long.2) A default configuration file path for Windows has not been decided and is currently TODO. I'm not sure what is best here as I don't use Windows much. Once a decision has been made then I'm happy to implement it.3) Not tested on Windows yet. Once point 2 is done if someone can assist with this that would be perfect, if not I can try it myself.