Text search tool for programmers, inspired by Ack Beyond Grep and Ag Silver Searcher and written in portable C++20.
While ack and ag are written in Perl and C with Linux system headers respectively (port to Windows also exists), glug is written in fully portable C++17 instead, and aims to provide C bindings for use in other languages and programs (e.g. Python-based vim plugin).
It also strives for high quality of development, targetting 100% test coverage and 100% accurate .gitignore implementation1, all checked with CI workflows blocking any failing code from being committed.
Currently, the provided binaries are for testing and demonstration purposes, showcasing the .gitignore implementation by recursively listing files in target directory.
grep-like in-file search is to be implemented by the next 0.2.0 release.
Similarly to ack and ag, glug implements convenient shorthands for searching just in files related to given programming language.
Whereas those two spell it using separate options like ag --cpp or ack --cpp --nohpp, glug instead expands any glob prefixed with unescaped # into a set of globs stored in its database.
This allows unambiguous mixing of type tags with regular globs, so the two examples above would be spelled as '#cpp' and '#cpp,-#hpp respectively.
Currently implemented handful of type tags can be seen in glug --help-tags, with aim to expand in the future and allow user to extend it via config files.
Check releases tab to find latest stable executable for your system.
Release binaries have format glug-${version}-${os}-${arch}-${static:-}-${regex:-}
regex is the regular expression provider, choosing alternative may increase your performance depending on your machine and usage:
stl- default<regex>, omitted in filenamepcre2- popular implementation of Perl regex, usually already present on Linux as a common dependencyre2- Google's implementation based on finite state machineshyperscan- Intel's x86-only implementation leveraging SIMD instructions to increase performance
- Install
xmake, can be found on most package providers such aspacman,apt,winget - Optionally, use
xmake configto set compilation options (need to set them all at once, as each invocation might reset unmentioned options to default):--regex=stl|pcre2|re2|hyperscan--toolchain=gcc|clang|msvc|...--mode=release|releasedbg|debug|coverage--kind=static|shared
- Run
xmake build -vto compile executable and tests - Optionally, run tests with
xmake test -vxmake test -v unit_test/defaultruns regulargtest-based UTxmake test -v parity_test/defaultruns integration tests, comparing results ofglugwith those ofgit ls-fileson popular repositories1
- Binaries can be found in
build/${os}/${arch}/${mode}, copied tobuild/latest