aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.rs
AgeCommit message (Collapse)Author
2020-08-04Add license (GNU GPLv3+)Teddy Wing
2020-08-03Config: Add a version argumentTeddy Wing
Allow getting the program version from the command line.
2020-08-02Add documentation commentsTeddy Wing
Light documentation for our various functions and types.
2020-08-02Move suggestion arguments check to `Config::get`Teddy Wing
Since this check for suggestion arguments is in both binaries, we can move it to the common preflight function. Clean up other areas now that we moved the function.
2020-08-02Config: Add description to `--github-token` argumentTeddy Wing
2020-08-02Config: Add description to `--remote` argumentTeddy Wing
2020-08-02Add `-h` argumentTeddy Wing
Print usage on `-h` and `--help`. Store the usage brief on `Config` in order to be able to print it from multiple places.
2020-08-02git-sugpatch: Print usage with no suggestion argumenetTeddy Wing
Add `Options` to `Config` to allow us to get a usage string from a `Config` instance, which is where we create `Options`. Needed to remove the `Debug` derive on `Config` in order to add the field as `Options` doesn't implement `Debug`.
2020-08-02Config: Remove old lineTeddy Wing
This was a test, before I worked out the API for this function.
2020-08-02config::Error::EnvVar: Include the variable name in the error messageTeddy Wing
The source error's message doesn't include the name. Ensure we print the name of the variable we're trying to get so that users know which one is missing.
2020-08-02config::Error::Opts: Include source error in messageTeddy Wing
Ensure the source error is surfaced.
2020-08-02git-sugpatch: Error if no remote and suggestion ID argumentTeddy Wing
We want to allow not having a remote when URL arguments are given, but require it when a suggestion ID argument is given (otherwise we wouldn't have an owner-repo pair to make the GitHub request). Had some trouble with the `OwnerRepo.o_r` value. It was being moved into the closure, so tried a loop. There was a similar problem with the loop. However, by returning, I was able to get a reference to the `Result` instead of having it be moved.
2020-08-01Config: Add suggestion argumentsTeddy Wing
Store the suggestion references specified on the command line.
2020-08-01Config: Extract `remote` into functionTeddy Wing
2020-08-01Config: Move `github_token` to a functionTeddy Wing
Improve organisation.
2020-08-01Get configTeddy Wing
We need the following values in order to build a `Client`: * GitHub token * Repo owner * Repo name Get the token from a command-line argument, or else the Git config, or else an environment variable. Get the repo identifiers from the repo's remote URL. Use the remote specified as a command-line argument, otherwise get it from the Git config, or else default to "origin". TODO: Only try to get the owner-name pair from the remote if a comment ID was given, not if a URL argument was passed.