In general, the usage can be reduced to:
tnt [option]... pattern [directory]
Let's see this in action. For example, if you want to search for redis
in the config
directory, you would write:
tnt redis config
In case you write
tnt redis
it will search within the current directory, just like you were writing
tnt redis .
Sometimes, you only want to search a pattern in laravel blade templates files. For example you want all files that have a mailto link:
tnt --blade "mailto:"
Just like searching blade files, sometimes you only want to include PHP files:
tnt --php "Controller"
You can also search for javascript files only
tnt --js "router"
You can also search for css files only
tnt --css "float"
By default, TNT Code Search is case sensitive, if you don't know with which case a pattern is written, you might do a case insensitive search:
tnt -i "controller"
TNT Code Search skips the vendor folder, because most of the time, you only need result from your code.
In case you still need results form the vendor, you use the vendor
flag
tnt --vendor "tntsearch"
TNT Code Search also supports regular expressions, so if you need to search for a regex pattern you can
tnt "tnt(.*)"