Septum provides local, command line interactive text search.
Septum 0.2.0 is released. Alire release is pending, you can get a Windows prebuilt exe or build from GitHub.
ripgrep and similar tools are great for finding matching lines in projects. Sometimes I don’t know entirely exactly for what I’m searching, or the order of terms, or the term is used in a variety of contexts I need to sift through, which is what Septum does. In the 4+ years since I wrote this, I haven’t found another good tool for this.
Septum searches for groups of lines up a specific width with all the terms you want, and none that you don’t want.
The idea is simple:
- Load all the files into memory.
- Look for groups of consecutive lines which match the “find-*” filters, and don’t have anything in a “exclude-*” filter.
The search tool stays active as you find-text, exclude-text, drop, reorder filters and such. This makes it easier to find examples where there are multiple terms for which I’m looking, and I can whittle down the search space with exclude-* filters. Normally match-contexts or enable-auto-search are used to display results, but with the new path filters, match-files can be used with find-path and exclude-path to find and cut out parts of the search tree interfering with your search.
This all runs locally, with minimum dependencies and no built search indices. It sounds too simple, but in practice works really well. I can load my entire personal project directory of ~29 million lines of code (my own, dependencies, and various open source projects) and text (like the AARM) on my Linux box and iteratively search in ~2 seconds (i5-10400 CPU, 12 cores). Sure, it uses 3.8 GB, but you can dump the cache with unload if needed temporarily and use the usual reload to bring it back. Not elegant, but sometimes you need to chisel searches out a bit at a time.
To get started, set up a directory for search. The config this creates simply contains septum commands, like add-dir .. If you have global options you want to use, you can use %LOCALAPPDATA%/septum/config (Windows), ~/Library/Application Support/septum/config (Mac) or $XDG_CONFIG_HOME/septum/config or $HOME/.config/septum/config (Linux).
septum init
Then run it to start searching, if you need help, type “help”:
septum
It’s been a while since I’ve talked about this project, so here’s the changes since 0.0.7 in 2022. There’s still quite a few features I want to add in the future, but maybe this project will be as useful to others as I have found.
[0.2.0]
Added runcommand to match command linerun.
Added add-filescommand to add specific files to the search.
Added clear-filescommand to remove custom added files to search.
Added find-pathcommand to only search paths with a term.
Added exclude-pathcommand to exclude files with a term from the search.
Added clear-path-filterscommand to clear path filters.
Deprecated the sourcecommmand. Useruninstead.
Optimized search by fixing a bug which pinned all but one search task.
Optimized search by eliminating some data copies.
Fixed list-file edge case not causing the command to fail.
BREAKING CHANGE! Linux top-level configs checked using XDG conventions (default: ~/.config/septum/config)
BREAKING CHANGE! Windows top-level configs now in %LOCALAPPDATA%/septum/config
BREAKING CHANGE! Fixed home config location on Windows to use USERPROFILE.
Added GNATformat options to build to enforce coding standards.
Upgraded AnsiAda to 0.1.1.
Upgraded progress_indicators to 0.0.2.
Upgraded trendy_terminal to 0.0.6.
[0.1.1]
Added support for unloadcommand to drop directories.
Added list-filescommand to list a number or all files.
Added loading of all “text-like” files, not just known extensions.
Fixedslow printing on large files.
[0.1.0]
Set enable-auto-searchby default inseptum init.
dropwith filter numbers now runs auto-search when enabled.
Fixed problem where runcommand doesn’t verify the terminal environment is set up properly.
Added support for ‘#’ comments and empty lines in scripts.
Optimized small loads by using a stop token instead of a wait.