Merge pull request #472 from ViktorHaag/revert-471-ag-past-version-one
Revert "fix version logic for major version > 0"
This commit is contained in:
		
						commit
						d170ef1363
					
				
							
								
								
									
										28
									
								
								src/_ag
								
								
								
								
							
							
						
						
									
										28
									
								
								src/_ag
								
								
								
								
							| 
						 | 
					@ -40,15 +40,14 @@
 | 
				
			||||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
 | 
					# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
 | 
				
			||||||
# vim: ft=zsh sw=2 ts=2 et
 | 
					# vim: ft=zsh sw=2 ts=2 et
 | 
				
			||||||
# ------------------------------------------------------------------------------
 | 
					# ------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 | 
				
			||||||
_ag_version() {
 | 
					_ag_version() {
 | 
				
			||||||
  local version
 | 
					  local version
 | 
				
			||||||
  version=( $($words[1] --version) )
 | 
					  version=( $($words[1] --version) )
 | 
				
			||||||
  version=${${(z)${version[1]}}[2]}
 | 
					  version=${version[@]:2:1}
 | 
				
			||||||
  echo $version
 | 
					  version=( "${(@s/./)version}" )
 | 
				
			||||||
 | 
					  echo "${version[2]}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
# Dynamically build the file type completion
 | 
					# Dynamically build the file type completion
 | 
				
			||||||
# Modifies the global $AG_OPTS array
 | 
					# Modifies the global $AG_OPTS array
 | 
				
			||||||
_ag_add_file_types() {
 | 
					_ag_add_file_types() {
 | 
				
			||||||
| 
						 | 
					@ -70,9 +69,9 @@ _ag_add_file_types() {
 | 
				
			||||||
# Add version appropriate options above base
 | 
					# Add version appropriate options above base
 | 
				
			||||||
# Modifies the global $AG_OPTS array
 | 
					# Modifies the global $AG_OPTS array
 | 
				
			||||||
_ag_add_version_opts() {
 | 
					_ag_add_version_opts() {
 | 
				
			||||||
  local ag_version=$(_ag_version)
 | 
					  local minor=$(_ag_version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ $ag_version > 0.21 ]]; then
 | 
					  if [[ $minor -gt 21 ]];then
 | 
				
			||||||
    _ag_add_file_types
 | 
					    _ag_add_file_types
 | 
				
			||||||
    AG_OPTS+=(
 | 
					    AG_OPTS+=(
 | 
				
			||||||
      '(- 1 *)--list-file-types[list supported filetypes to search]'
 | 
					      '(- 1 *)--list-file-types[list supported filetypes to search]'
 | 
				
			||||||
| 
						 | 
					@ -80,20 +79,19 @@ _ag_add_version_opts() {
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if [[ $minor -gt 22 ]];then
 | 
				
			||||||
  if [[ $ag_version > 0.22 ]]; then
 | 
					 | 
				
			||||||
    AG_OPTS+=(
 | 
					    AG_OPTS+=(
 | 
				
			||||||
      '(-z --search-zip)'{-z,--search-zip}'[search contents of compressed files]'
 | 
					      '(-z --search-zip)'{-z,--search-zip}'[search contents of compressed files]'
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ $ag_version <= 0.24 ]]; then
 | 
					  if [[ $minor -le 24 ]];then
 | 
				
			||||||
    AG_OPTS+=(
 | 
					    AG_OPTS+=(
 | 
				
			||||||
      '(-s --case-sensitive)'{-s,--case-sensitive}'[match case sensitively]'
 | 
					      '(-s --case-sensitive)'{-s,--case-sensitive}'[match case sensitively]'
 | 
				
			||||||
      '(--noheading --heading)'{--noheading,--heading}'[print file names above matching contents]'
 | 
					      '(--noheading --heading)'{--noheading,--heading}'[print file names above matching contents]'
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  if [[ $ag_version > 0.24 ]]; then
 | 
					  if [[ $minor -gt 24 ]];then
 | 
				
			||||||
    AG_OPTS+=(
 | 
					    AG_OPTS+=(
 | 
				
			||||||
      '(-s --case-sensitive)'{-s,--case-sensitive}'[Match case sensitively. Default on.]'
 | 
					      '(-s --case-sensitive)'{-s,--case-sensitive}'[Match case sensitively. Default on.]'
 | 
				
			||||||
      '(-H --noheading --heading)'{-H,--noheading,--heading}'[print file names above matching contents]'
 | 
					      '(-H --noheading --heading)'{-H,--noheading,--heading}'[print file names above matching contents]'
 | 
				
			||||||
| 
						 | 
					@ -101,18 +99,18 @@ _ag_add_version_opts() {
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ $ag_version > 0.26 ]]; then
 | 
					  if [[ $minor -gt 26 ]];then
 | 
				
			||||||
    AG_OPTS+=(
 | 
					    AG_OPTS+=(
 | 
				
			||||||
      '(-0 --null --print0)'{-0,--null,--print0}'[separate the filenames with \\0, rather than \\n]'
 | 
					      '(-0 --null --print0)'{-0,--null,--print0}'[separate the filenames with \\0, rather than \\n]'
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ $ag_version <= 0.27 ]]; then
 | 
					  if [[ $minor -le 27 ]];then
 | 
				
			||||||
    AG_OPTS+=(
 | 
					    AG_OPTS+=(
 | 
				
			||||||
      '--depth[Search up to NUM directories deep. Default is 25.]:number'
 | 
					      '--depth[Search up to NUM directories deep. Default is 25.]:number'
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  if [[ $ag_version > 0.27 ]]; then
 | 
					  if [[ $minor -gt 27 ]];then
 | 
				
			||||||
    AG_OPTS+=(
 | 
					    AG_OPTS+=(
 | 
				
			||||||
      '(-c --count)'{-c,--count}'[only print the number of matches in each file]'
 | 
					      '(-c --count)'{-c,--count}'[only print the number of matches in each file]'
 | 
				
			||||||
      '--depth[Search up to NUM directories deep, -1 for unlimited. Default is 25.]:number'
 | 
					      '--depth[Search up to NUM directories deep, -1 for unlimited. Default is 25.]:number'
 | 
				
			||||||
| 
						 | 
					@ -120,12 +118,12 @@ _ag_add_version_opts() {
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ $ag_version <= 0.28 ]]; then
 | 
					  if [[ $minor -le 28 ]];then
 | 
				
			||||||
    AG_OPTS+=(
 | 
					    AG_OPTS+=(
 | 
				
			||||||
      '(--no-numbers)--no-numbers[don´t show line numbers]'
 | 
					      '(--no-numbers)--no-numbers[don´t show line numbers]'
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  if [[ $ag_version > 0.28 ]]; then
 | 
					  if [[ $minor -gt 28 ]];then
 | 
				
			||||||
    AG_OPTS+=(
 | 
					    AG_OPTS+=(
 | 
				
			||||||
      '(--nofilename --filename)'{--nofilename,--filename}'[Print file names. Default on, except when searching a single file.]'
 | 
					      '(--nofilename --filename)'{--nofilename,--filename}'[Print file names. Default on, except when searching a single file.]'
 | 
				
			||||||
      '(--nonumbers --numbers)'{--nonumbers,--numbers}'[Print line numbers. Default is to omit line numbers when searching streams]'
 | 
					      '(--nonumbers --numbers)'{--nonumbers,--numbers}'[Print line numbers. Default is to omit line numbers when searching streams]'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue