One line of grep explained:
grep 'TODO' -r -n --exclude-dir={node_modules,.git,lib} --exclude={"*bundle.js","*.map","*.min.js","*.csv",todos.txt} . > todos.txt
This command searches through a directory and its subdirectories for TODO comments and writes them to a text file.
grep is a file pattern searcher and 'TODO' is the pattern we are searching our directories and files for
-r – search recursively through a directory and its subdirectories
-n – label lines matched and returned with their line numbers
--exclude-dir and --exclude – there may be many files and directories that we don't want to search through. Use brace expansion to
list them. Just make sure to not leave whitespace in the comma-separated list. Also it's very important that you list the file you are
writing your output to in the --exclude option, otherwise your file may not terminate and will continue writing your filename indefinitely
. – a single dot represents the current working directory. Our -r flag will search this directory and all its subdirectories
> – this is a bash redirection operator. It redirects the output of this command from the terminal screen to the todos.txt file.