CLI tool to help you analyze code usage in your project.
Flashlight allows you to perform searches that would be difficult with normal string or regex searching such as:
- Find all imports from
reactthat importeduseMemo - Find all
<Button>tags with the attributetype="primary"
Regex searches can work for this at times, but it becomes very complex when imports or tags span multiple lines. Flashlight provides a much easier way to perform these searches.
You can install Flashlight by running the install script which will download the latest release.
curl -LSfs https://go.mskelton.dev/flashlight/install | shOr you can build from source.
git clone git@github.com:mskelton/flashlight.git
cd flashlight
cargo install --path .Searches for all imports for a given import source.
flashlight imports reactYou can also search for a specific import specifier.
flashlight imports react useStateSearches for all JSX elements with the given name.
flashlight tags ButtonYou can also search for elements with a specific attribute or attribute/value pair.
flashlight tags Button variant
flashlight tags Button variant=primaryBy default, flashlight uses the current working directory to search. You can
change the working directory using the --cwd argument.
flashlight --cwd ./packages/a imports reactYou can customize the output format based on your use case. The supported formats are:
default- The default console formatjson- Formats the output as JSONquickfix- Formats the output as a Vim quickfix list (aliasvi)
flashlight --format json imports react