-
Notifications
You must be signed in to change notification settings - Fork 23
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
Argparser and file options #41
Open
Profpatsch
wants to merge
10
commits into
justinwoo:master
Choose a base branch
from
Profpatsch:argparser-and-file-options
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Argparser and file options #41
Profpatsch
wants to merge
10
commits into
justinwoo:master
from
Profpatsch:argparser-and-file-options
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updates the package set from 0.13.0 to 0.13.3, which is the closest release that contains optparse.
Preparing to add flags to generate, so we can pass the spago.dhall file and cache directory. The resulting parser should be more or less the same, apart from a slight difference in the usage text. I tried keeping it as similar as possible.
And a bit of shuffling to import the sources in the right way. default.nix should have the same interface than before, I make sure the existing args are still there. Originally created with niv, but removed all the bs.
The default of `./.spago2nix` not super helpful when running spago2nix from a script that should run in a temporary directory but still use the existing cache directory.
Similarly to the `--cache-dir` option, when running `spago2nix` from a script the current working dir is often a tempdir outside of our source directory, thus we need a way to pass the path to `spago.dhall`. Since dhall handles relative imports based on file location, just passing the “entry point” `spago.dhall` is enough.
If somebody passes e.g. `--spago-dhall=`, that would mean they reference `.`, which is dumb.
Previously we just parsed argv, but the optparse library recognizes `-*` as options now, so the rest of the argv needs to be splitt off with `--`, as customary. This is a breaking change.
Add a CHANGELOG file and document the breaking change to the nix argv.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contains #40
This fixes a downstream problem we have in a company project, where in order to run spago2nix in a temporary directory we need to jump through hoops to copy the
.spago2nix
andspago.dhall
files around instead of just passing them as arguments.I took the chance to switch to an optparse library, which simplifies adding new flags by a lot (until now it was only positional arguments, but optional stuff like flags is not so easy to parse adhoc-ly.
Alternatively, we could keep the argparser as it is and stub the files with environment variables.