aboutsummaryrefslogtreecommitdiffstats
path: root/src/diff_options.rs
AgeCommit message (Collapse)Author
2020-08-30diff_options: Merge `ARG_OPTIONS` and `OPT_OPTIONS`Teddy Wing
Now that I've confirmed that Git's key value options require an '=' to specify the value, we can drop the distinction between options that require and argument and those that optionally take an argument. Also remove the code that interprets an argument that doesn't start with '-' as the value of the preceding option.
2020-08-30diff_options: Clean up codeTeddy Wing
Remove old process code and comments.
2020-08-29diff_options: Remove non-equals argument value handlingTeddy Wing
Tested out diff arguments with Git, and it turns out that arguments in the following form: $ git diff --word-diff color are not allowed. This error results: fatal: ambiguous argument 'color': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' Thus, option all arguments require the equals character to specify the value of those arguments. We can make the logic much simpler by eliminating handling of space-separated argument values altogether. This fixes the problem of suggestion positional arguments being misinterpreted as `OPT_OPTIONS` argument values.
2020-08-29git-sugdiff: Use `diff_options.parse()` to extract diff optionsTeddy Wing
Config::get(): Change `args` type so we can pass both a `Vec<String>` and `Vec<&String>`. diff_options.parse(): * Split diff arguments and program arguments by returning a tuple. * Exit the args loop once we've parsed an argument. * Update test * Add a non-working test for suggestion arguments. An `OPT_OPTIONS` argument could be followed by an argument that's not the value of the `OPT_OPTIONS` option. Currently, that arg will always be parsed as the value. We need to handle this case.
2020-08-26Add `diff_options` to parse Git diff optionsTeddy Wing
In order to accept Git diff options on the command line, we need a way to extract these from args. Add a function to parse diff options. These were sourced from: https://github.com/git/git/blob/675a4aaf3b226c0089108221b96559e0baae5de9/Documentation/diff-options.txt The function loops through the input arguments and extracts all diff options and their values. Still needs some work to integrate it into `git-sugdiff`, but it currently works as advertised.