# HG changeset patch # User Steve Losh # Date 1442507882 0 # Node ID 634131bfbe10f82fb035f61082a86e4bb3aee384 # Parent b70a423990d3d7f1c662ae73184113cd2ef076b2# Parent b44883779e1b4b4fb0efa33522a8545b87877ebc Merge. diff -r b70a423990d3 -r 634131bfbe10 fish/functions/ag.fish --- a/fish/functions/ag.fish Thu Sep 17 16:32:54 2015 +0000 +++ b/fish/functions/ag.fish Thu Sep 17 16:38:02 2015 +0000 @@ -1,35 +1,10 @@ -set -g -x AG_BIN (which ag) - -function actual_ag - # Fuck you fish this is fucking ridiculous. Let me use $AG_BIN as - # a command. Or at least give me a way to do it like run $AG_BIN args or - # something jesus. - if test $AG_BIN = '/usr/local/bin/ag' - /usr/local/bin/ag $argv +function ag -d "Run Ag with appropriate options." + if begin test -f '.agignore'; and grep -q 'pragma: skipvcs' '.agignore'; end + # If .agignore contains pragma: skipvcs, then we'll run ag in + # "disregard .gitignore/.hgignore/svn:ignore" mode. This lets us + # still search in files the VCS has ignored. + command ag --search-files -U $argv else - if test $AG_BIN = '/usr/bin/ag' - /usr/bin/ag $argv - else - echo "Fish is a dick, sorry." - end + command ag --search-files $argv end end - -function ag -d "Run Ag with appropriate options." - if test -f '.agignore' - # Extra if statement because I can't figure out how to && things in - # a fish conditional and the documentation does not see fit to explain - # that little tidbit and can we please get a shell without complete - # bullshit as a scripting language syntax? - if grep -q 'pragma: skipvcs' '.agignore' - # If .agignore contains pragma: skipvcs, then we'll run ag in - # "disregard .gitignore/.hgignore/svn:ignore" mode. This lets us - # still search in files the VCS has ignored. - actual_ag --search-files -U $argv - else - actual_ag --search-files $argv - end - else - actual_ag --search-files $argv - end -end