{"id":23497979,"url":"https://github.com/freedomben/findref","last_synced_at":"2025-10-03T19:21:25.017Z","repository":{"id":27425158,"uuid":"30902676","full_name":"FreedomBen/findref","owner":"FreedomBen","description":"findref is a grep-like program that helps you find strings in files using regexes","archived":false,"fork":false,"pushed_at":"2024-03-10T19:18:45.000Z","size":2501,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T21:51:12.517Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FreedomBen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-17T04:34:35.000Z","updated_at":"2024-03-05T08:04:41.000Z","dependencies_parsed_at":"2024-06-19T20:05:34.880Z","dependency_job_id":null,"html_url":"https://github.com/FreedomBen/findref","commit_stats":{"total_commits":133,"total_committers":1,"mean_commits":133.0,"dds":0.0,"last_synced_commit":"2f7f2391b42d318b8c339d12316845a4cf06d9f5"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomBen%2Ffindref","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomBen%2Ffindref/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomBen%2Ffindref/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomBen%2Ffindref/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FreedomBen","download_url":"https://codeload.github.com/FreedomBen/findref/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249099745,"owners_count":21212718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-25T05:17:36.902Z","updated_at":"2025-10-03T19:21:24.982Z","avatar_url":"https://github.com/FreedomBen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fr / findref\n\n\n![Version](https://img.shields.io/badge/Version-v1.3.0-green)\n\n`findref` (commonly aliased to `fr`) helps you find strings, or match regular expressions, in a directory of files.  It is inspired by `git grep` which is a good tool, but has limitations that made writing a replacement a worthy endeavor.\n\n`findref` regular expressions are golang regexes.  Golang regexes have \"the [same general\nsyntax](https://github.com/google/re2/wiki/Syntax) used by Perl, Python, and other languages.\nMore precisely, it is [the syntax accepted by RE2](https://github.com/google/re2/wiki/Syntax).\"\nA large benefit of this, is that \"the regexp implementation ... [is guaranteed to run in\ntime linear in the size of the input](https://swtch.com/~rsc/regexp/regexp1.html).\n(This is a property not guaranteed by most open source implementations of regular expressions.)\" (see: https://golang.org/pkg/regexp/).  This regex run-time is one of the things that makes\n`findref` faster than many other tools.\n\n\n## How it compares to other tools (or why it is better in my opinion):\n\n**grep**:  `findref` adds much simpler recursive search that doesn't require a bunch of\ntedious flags to get pleasant output.  It also ignores hidden files by default,\nwhich helps you avoid a lot of junk matches.  findref has a lot of handy command line\nswitches that make it easier to find the needle in the haystack.  For example, the ability\nto restrict search to files whose name matches a specified regex.  The output of `findref` is\nidentical to grep's line numbers and colors (but are on by default).  Speed-wise, grep\nis faster.  It's hard to beat this venerable tool in performance.\n\n**git grep**:  `findref` output looks very similar, but adds colorization, which makes\nreading it *much* easier.  `findref` also works on non-git repos, unlike git grep.  findref\nalso supports a variety of switches that make narrowing results easier.\n\n**Ag (or the silver searcher)**:  `findref` is slower (ag is amazingly fast), but has\nmuch better formatting and coloring.  `findref` does not currently have a vim\nplugin tho, so for searching within vim, [ag](https://github.com/vim-scripts/ag.vim)\nis the way to go.  Ag is also useful for very large codebases.\n\n\n## Usage\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/findref-usage.png\" alt=\"findref usage\"\u003e\n\u003c/p\u003e\n\n### Examples:\n\nLet's say we are looking for the string \"getMethodName\":\n\nSimple usage that starts looking recursively in the current directory, and checks all files (excluding binary files) for the string (which could also be a regular expression)\n\n    findref getMethodName\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/findref-simple.gif\" alt=\"findref simple usage\"\u003e\n\u003c/p\u003e\n\nTo go case insensitive, simply add -i or --ignore-case as the first arg:\n\n    findref --ignore-case getMethodName\n\nBy default `findref` uses \"smart-case\" for matches.  This means if the whole regex is lower\ncase, the match will be case-insensitve.  If there is an upper case letter, the match will be\ncase-sensiitive.  You can force case-sensitivity with the -m or --match-case flag:\n\n    findref --match-case getmethodname  # matches getmethodname but not getMethodName\n\nYou don't have to search only for strings.  You can pass any valid golang regex:\n\n    findref \"str[i1]ng.*\"\n    findref \"st.*ng\"\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/findref-regex.gif\" alt=\"findref regex usage\"\u003e\n\u003c/p\u003e\n\nYou can add a starting directory (if none is specified, the default is the current working directory):\n\n    findref \"str[i1]ng.*\" /home/ben/my-starting-directory\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/findref-starting-loc.gif\" alt=\"findref starting location usage\"\u003e\n\u003c/p\u003e\n\nIf you want to restrict which files are searched, you can also do this by passing a file\nmatching regex.  For example, to only search cpp files:\n\n    findref \"str[i1]ng.*\" \"~/my-starting-directory\" \".*.cpp\"\n\nOr to restrict the search to C++ code files (.h and .cpp):\n\n    findref \"str[i1]ng.*\" \"~/my-starting-directory\" \".*\\.[hc](pp)?\"\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/findref-file-regex.gif\" alt=\"findref file regex usage\"\u003e\n\u003c/p\u003e\n\n## Installation\n\n### Use the install script\n\nIf you are on an intel-based linux or mac, there is an install script located at\n`install.sh`.  If on ARM, Windows, or {Free,Open}BSD, you should download the\nappropriate [pre-built binary](#pre-built-binaries) below.\n\nTo let the script do the work, run this command.  Make sure to add `sudo` if\ninstalling to a location that isn't writeable by your normal user:\n\n#### In your home directory (Make sure this destination is in your [PATH](http://www.linfo.org/path_env_var.html) variable)\n\n```bash\ncurl -s https://raw.githubusercontent.com/FreedomBen/findref/master/install.sh | bash -s $HOME/bin\n```\n\n#### System-wide for all users (requires root access)\n```bash\ncurl -s https://raw.githubusercontent.com/FreedomBen/findref/master/install.sh | sudo bash -s /usr/local/bin\n```\n\n### Pre-built binaries\n\nIf you wish, you can download pre-built binaries for your system.  After downloading,\nput it somewhere in your [PATH](http://www.linfo.org/path_env_var.html).\n\nI recommend putting it in `~/bin` if you are the only user (`sudo` isn't required\nto install in that location), or `/usr/local/bin` if there are multiple users on the system:\n\n#### Current Release Version: 1.3.0\n\nThese links will always point to the latest released version, so they are includable in\nscripts to get the latest version without having to adjust the version number for new\nreleases.  Of course if you want to point to a specific release, find the permanent link\non the [ARCHIVES.md](ARCHIVES.md) page.\n\n| Version | Linux | macOS | Windows | FreeBSD | OpenBSD |\n|:-------:|:-----:|:-----:|:-------:|:-------:|:--------|\n| latest | [386](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/linux/386/findref.zip) - [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/linux/amd64/findref.zip) - [arm](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/linux/arm/findref.zip) - [arm64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/linux/arm64/findref.zip) | [386](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/darwin/386/findref.zip) - [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/darwin/amd64/findref.zip) - [arm64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/darwin/arm64/findref.zip) | [386](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/windows/386/findref.zip) - [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/windows/amd64/findref.zip) | [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/freebsd/amd64/findref.zip) - [arm64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/freebsd/arm64/findref.zip) | [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/openbsd/amd64/findref.zip) - [arm64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/latest/openbsd/arm64/findref.zip) |\n\nThese links are perma-links to the binaries for version 1.3.0, meaning even after\na new version is released, these will still get you version 1.3.0.\n\n| Version | Linux | macOS | Windows | FreeBSD | OpenBSD |\n|:-------:|:-----:|:-----:|:-------:|:-------:|:--------|\n| 1.3.0 | [386](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/linux/386/findref.zip) - [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/linux/amd64/findref.zip) - [arm](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/linux/arm/findref.zip) - [arm64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/linux/arm64/findref.zip) | [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/darwin/amd64/findref.zip) - [arm64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/darwin/arm64/findref.zip) | [386](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/windows/386/findref.zip) - [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/windows/amd64/findref.zip) | [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/freebsd/amd64/findref.zip) - [arm64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/freebsd/arm64/findref.zip) | [amd64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/openbsd/amd64/findref.zip) - [arm64](https://raw.githubusercontent.com/FreedomBen/findref-bin/master/1.3.0/openbsd/arm64/findref.zip) |\n\n### Older releases\n\nThe full catalog of releases is available to download.  See [ARCHIVES.md](ARCHIVES.md)\n\n### Building from source\n\nTo build from source you can either use the docker build wrapper, or build it directly on your system.\n\nIf you have your [Go environment](https://golang.org/doc/install) set up\nalready, you can build it directly from source:\n\n```bash\ngo get github.com/FreedomBen/findref\ngo install findref\n```\n\nTo use the docker build, the easiest way is to clone this repo and use the rake task:\n\n```bash\ngit clone https://github.com/FreedomBen/findref.git \\\n \u0026\u0026 cd findref \\\n \u0026\u0026 rake\n```\n\nPretty easy, the only downside being that it will build findref for every supported\nplatform rather than just the one you care about.  You can find the binary you\ncare about by looking in the `findref-bin` subdirectory and following the directory\nstructure until you find the correct binary for your system.\n\nYou can also build for just\nyour platform.  Specify your OS for the `GOOS` value, and your arch for `GOARCH`.\nSee [here for a list of valid targets](https://stackoverflow.com/a/30068222/2062384).\n\nClone the repo if you haven't already:\n\n```bash\ngit clone https://github.com/FreedomBen/findref.git \u0026\u0026 cd findref\n```\n\nThen run the build:\n\nExample for Linux x64 (amd64):\n\n```bash\ndocker run \\\n  --rm \\\n  --volume \"$(pwd):/usr/src/findref\" \\\n  --workdir \"/usr/src/findref\" \\\n  --env GOOS=linux \\\n  --env GOARCH=amd64 \\\n  golang:#{GO_VERSION} go build\n```\n\nExample for Linux x32 (386):\n\n```bash\ndocker run \\\n  --rm \\\n  --volume \"$(pwd):/usr/src/findref\" \\\n  --workdir \"/usr/src/findref\" \\\n  --env GOOS=linux \\\n  --env GOARCH=386 \\\n  golang:#{GO_VERSION} go build\n```\n\nExample for macOS x64 (amd64)\n\n```bash\ndocker run \\\n  --rm \\\n  --volume \"$(pwd):/usr/src/findref\" \\\n  --workdir \"/usr/src/findref\" \\\n  --env GOOS=darwin \\\n  --env GOARCH=amd64 \\\n  golang:#{GO_VERSION} go build\n```\n\nAfter the build your binary should be sitting in the root directory of the repo!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreedomben%2Ffindref","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreedomben%2Ffindref","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreedomben%2Ffindref/lists"}