ggreer / the_silver_searcher

A code-searching tool similar to ack, but faster.
http://geoff.greer.fm/ag/
Apache License 2.0
26.21k stars 1.43k forks source link

-i flag seems position dependent #372

Open aktau opened 10 years ago

aktau commented 10 years ago

Here's an example:

➜  neovim git:(master) ag -i -G '\.cmake|\.txt' 'output'
vim-license.txt
58:    3) A message must be added, at least in the output of the ":version"

➜  neovim git:(master) ag -G '\.cmake|\.txt' -i 'output'
cmake/FindLibIntl.cmake
17:            OUTPUT_STRIP_TRAILING_WHITESPACE
18:            OUTPUT_VARIABLE HOMEBREW_GETTEXT_PREFIX)

cmake/RunUnittests.cmake
7:  COMMAND ${BUSTED_PRG} -l ${LUAJIT_PRG} -o ${BUSTED_OUTPUT_TYPE}

CMakeLists.txt
66:set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
79:    OUTPUT_VARIABLE MAKE_VERSION_INFO)
80:  if(NOT "${OUTPUT_VARIABLE}" MATCHES ".*GNU.*")
96:if(NOT BUSTED_OUTPUT_TYPE)
97:  set(BUSTED_OUTPUT_TYPE "utf_terminal")
108:      -DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
122:#     VIMPROG=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nvim)

config/CMakeLists.txt
28:    OUTPUT_STRIP_TRAILING_WHITESPACE
29:    OUTPUT_VARIABLE USERNAME)
33:    OUTPUT_STRIP_TRAILING_WHITESPACE
34:    OUTPUT_VARIABLE HOSTNAME)

test/includes/CMakeLists.txt
8:    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile}

third-party/CMakeLists.txt
25:    OUTPUT_VARIABLE MAKE_VERSION_INFO)
26:  if(NOT "${OUTPUT_VARIABLE}" MATCHES ".*GNU.*")
126:  add_custom_command(OUTPUT ${DEPS_BIN_DIR}/moon ${DEPS_BIN_DIR}/moonc
136:  add_custom_command(OUTPUT ${DEPS_BIN_DIR}/busted

vim-license.txt
58:    3) A message must be added, at least in the output of the ":version"

I don't know if that's intentional or not.

jorgenpt commented 10 years ago

I'm pretty sure this changed after last time I upgraded the_silver_searcher, so it seems like a regression. It used to pick up -i fine. (Things that I was doing via muscle memory no longer behaved like I expected them to)

jorgenpt commented 10 years ago

So this is an intentional feature introduced in #303, -i now makes the filename pattern insensitive. This is pretty confusing - I'd rather it was separate option (-I instead of -G, or something along those lines) than make -i suddenly do something else based on its position on the command line. (cc @ggreer)

jorgenpt commented 10 years ago

There's also nothing in --help to indicate this change of behavior.