diff options
| author | Teddy Wing | 2020-08-30 01:20:33 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2020-08-30 01:20:33 +0200 | 
| commit | 905594dc8393f97c1a960d639af46175b3e6b76f (patch) | |
| tree | 6da6984c4fa0495ea9ed11ab69a4400e99978e78 /src | |
| parent | b9729227347e0532891321548b31579b80376bdd (diff) | |
| download | git-suggestion-905594dc8393f97c1a960d639af46175b3e6b76f.tar.bz2 | |
diff_options: Clean up code
Remove old process code and comments.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/git-sugdiff.rs | 5 | ||||
| -rw-r--r-- | src/config.rs | 2 | ||||
| -rw-r--r-- | src/diff_options.rs | 176 | 
3 files changed, 0 insertions, 183 deletions
| diff --git a/src/bin/git-sugdiff.rs b/src/bin/git-sugdiff.rs index ab893f0..62bec8f 100644 --- a/src/bin/git-sugdiff.rs +++ b/src/bin/git-sugdiff.rs @@ -28,12 +28,7 @@ use github_suggestion_cli::diff_options;  fn main() {      let args: Vec<_> = env::args().collect(); -    // TODO: Shift all diff options from args, then pass them to Config::get(). -    // Add diff options to Command call below. -      let (args, diff_args) = diff_options::parse(&args); -    dbg!(&args); -    dbg!(&diff_args);      let config = match Config::get(          &args, diff --git a/src/config.rs b/src/config.rs index 77793c4..c76abf3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -58,8 +58,6 @@ pub struct Config {  impl Config {      /// Set up command line arguments. Extract configuration values from command      /// line arguments, Git config, and environment variables. -    // pub fn get<C: IntoIterator>(args: C, usage_brief: &str) -> Result<Self, Error> -    // where C::Item: AsRef<OsStr>      pub fn get<S: AsRef<OsStr>>(args: &[S], usage_brief: &str) -> Result<Self, Error> {          let mut opts = Options::new(); diff --git a/src/diff_options.rs b/src/diff_options.rs index 108fc13..a35acfd 100644 --- a/src/diff_options.rs +++ b/src/diff_options.rs @@ -76,48 +76,6 @@ static FLAGS: [&'static str; 59] = [      "--ita-invisible-in-index",  ]; -// static OPTIONS: [&'static str; 21] = [ -//     "-U<n>", -//     "--unified=<n>", -//     "--output=<file>", -//     "--output-indicator-new=<char>", -//     "--output-indicator-old=<char>", -//     "--output-indicator-context=<char>", -//     "--anchored=<text>", -//     "--diff-algorithm={patience|minimal|histogram|myers}", -//     "--stat[=<width>[,<name-width>[,<count>]]]", -//     "-X[<param1,param2,...>]", -//     "--dirstat[=<param1,param2,...>]", -//     "--dirstat-by-file[=<param1,param2>...]", -//     "--submodule[=<format>]", -//     "--color[=<when>]", -//     "--color-moved[=<mode>]", -//     "--color-moved-ws=<modes>", -//     "--word-diff[=<mode>]", -//     "--word-diff-regex=<regex>", -//     "--color-words[=<regex>]", -//     "--ws-error-highlight=<kind>", -//     "--abbrev[=<n>]", -//     "-B[<n>][/<m>]", -//     "--break-rewrites[=[<n>][/<m>]]", -//     "-M[<n>]", -//     "--find-renames[=<n>]", -//     "-C[<n>]", -//     "--find-copies[=<n>]", -//     "-l<num>", -//     "--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]", -//     "-S<string>", -//     "-G<regex>", -//     "--find-object=<object-id>", -//     "-O<orderfile>", -//     "--relative[=<path>]", -//     "--inter-hunk-context=<lines>", -//     "--ignore-submodules[=<when>]", -//     "--src-prefix=<prefix>", -//     "--dst-prefix=<prefix>", -//     "--line-prefix=<prefix>", -// ]; -  static ARG_OPTIONS: [&'static str; 20] = [      "-U",      "--unified", @@ -164,7 +122,6 @@ static OPT_OPTIONS: [&'static str; 19] = [  ]; -// pub fn parse(args: &[String]) -> &[String] {  pub fn parse(args: &[String]) -> (Vec<&String>, Vec<&String>) {      let mut program_args = Vec::new();      let mut found_args = Vec::new(); @@ -173,7 +130,6 @@ pub fn parse(args: &[String]) -> (Vec<&String>, Vec<&String>) {      'args: for arg in args {          let find_arg_prefix = arg.find('-'); -        // TODO: Ignore suggestion args          if add_next_arg              && (                  find_arg_prefix.is_none() @@ -195,55 +151,22 @@ pub fn parse(args: &[String]) -> (Vec<&String>, Vec<&String>) {              }          } -        // TODO: check for "=" and get next arg -        // '=' -        // if no equals, then add next arg -        // Turns out values are always specified with '='          for option in &ARG_OPTIONS {              if arg.starts_with(option) {                  found_args.push(arg); -                // if arg doesn't have an = after it -                // if i < arg.len() { -                // let char_after_option = arg.get(option.len()); -                // if char_after_option.is_some() -                //         && char_after_option.unwrap() == '=' { - -                let (_option, rest) = arg.split_at(option.len()); - -                dbg!(arg); -                dbg!(arg.len()); -                dbg!(option); -                dbg!(option.len()); -                dbg!(rest.find('=').is_none()); -                // if arg.len() > option.len() -                //         && rest.find('=').is_none() { -                // if rest.find('=').is_none() { -                //     add_next_arg = true; -                // } -                  continue 'args;              }          } -        // check '=' -        // If no equals, add next arg if it doesn't begin with '-' -        // OptOptions are always followed by '=' when specifying values          for option in &OPT_OPTIONS {              if arg.starts_with(option) {                  found_args.push(arg); -                // let (_option, rest) = arg.split_at(option.len()); -                // -                // if rest.find('=').is_none() { -                //     add_next_arg = true; -                // } -                  continue 'args;              }          } -        // TODO: Otherwise, add to normal arguments list          program_args.push(arg)      } @@ -309,102 +232,3 @@ mod tests {          ]);      }  } - -// -p -// --no-stat -// -p -// -u -// --patch -// -s -// --no-patch -// -U<n> -// --unified=<n> -// --output=<file> -// --output-indicator-new=<char> -// --output-indicator-old=<char> -// --output-indicator-context=<char> -// --raw -// --patch-with-raw -// -t -// --indent-heuristic -// --no-indent-heuristic -// --minimal -// --patience -// --histogram -// --anchored=<text> -// --diff-algorithm={patience|minimal|histogram|myers} -// --stat[=<width>[,<name-width>[,<count>]]] -// --compact-summary -// --numstat -// --shortstat -// -X[<param1,param2,...>] -// --dirstat[=<param1,param2,...>] -// --cumulative -// --dirstat-by-file[=<param1,param2>...] -// --summary -// --patch-with-stat -// -z -// --name-only -// --name-status -// --submodule[=<format>] -// --color[=<when>] -// --no-color -// --color-moved[=<mode>] -// --no-color-moved -// --color-moved-ws=<modes> -// --no-color-moved-ws -// --word-diff[=<mode>] -// --word-diff-regex=<regex> -// --color-words[=<regex>] -// --no-renames -// --[no-]rename-empty -// --check -// --ws-error-highlight=<kind> -// --full-index -// --binary -// --abbrev[=<n>] -// -B[<n>][/<m>] -// --break-rewrites[=[<n>][/<m>]] -// -M[<n>] -// --find-renames[=<n>] -// -C[<n>] -// --find-copies[=<n>] -// --find-copies-harder -// -D -// --irreversible-delete -// -l<num> -// --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]] -// -S<string> -// -G<regex> -// -S"frotz\(nitfol" --pickaxe-regex` will not (because the number of -// --find-object=<object-id> -// --pickaxe-all -// --pickaxe-regex -// -O<orderfile> -// -R -// --relative[=<path>] -// --no-relative -// -a -// --text -// --ignore-cr-at-eol -// --ignore-space-at-eol -// -b -// --ignore-space-change -// -w -// --ignore-all-space -// --ignore-blank-lines -// --inter-hunk-context=<lines> -// -W -// --function-context -// --exit-code -// --quiet -// --ext-diff -// --no-ext-diff -// --textconv -// --no-textconv -// --ignore-submodules[=<when>] -// --src-prefix=<prefix> -// --dst-prefix=<prefix> -// --no-prefix -// --line-prefix=<prefix> -// --ita-invisible-in-index | 
