is a short lua utility for lightweight daily fs search.
find
,fd
: don't provide powerful options or search speedgrep
,rg
: use extremely plain parsing rules, limited for only daily usagefzf
: lightweight and no interaction, you should know what you want, just lazy
fss
: search paths with patterns, and print to stdoutfop
: read stdin line by line and open witharg[1]
install via luarocks
luarocks install fss
clone and manually install
git clone [email protected]:LighghtEeloo/fss.git
cd fss
sudo luarocks make
customize by yourself
# config
CONFIG=$(HOME)/.config/fss
mkdir $CONFIG && cd $CONFIG
touch rc.lua
in rc.lua
:
-- write three functions according to the rc manual below.
return {
noticeable = noticeable,
expandable = expandable,
depth_limit = depth_limit,
}
note {}
means repeat 0 or any times, |
means either.
usage: fss <PATTERNS> <PATH>{ <PATH>}
where: <PATH> ::= / | /<name>{/<name>} | <name>{/<name>}
<PATTERNS> ::= <PATTERN>{,<PATTERN>}
<PATTERN> ::= <cstr>{.<cstr>}
<cstr> ::= <consecutive str>
<name> ::= <file name>
means: given a group of patterns,
use each pattern to search in all paths recursively;
and output the combined results in stdout.
also: if one path already satisfies, its children will not be included
e.g.: X.482.H : 1 pattern, which finds Xpace/EECS-482/Homeworks
e.g.: Xp.e.482.H : 1 pattern, does the same
e.g.: Xe.482.H : 1 pattern, but fails the prev search
e.g.: X.482.H,Y : 2 patterns, find [<prev search>, Yggdrasill]
but no more children under Yggdrasill
depth_limit
: givendepth
returns whether the depth excceeds limit; stops search if truenoticeable
: given(dirpath, item_name)
, returns whether the item will appear in search memo and ready for a matchexpandable
: given(dirpath, item_name)
, returns whether the item needs to be recursively searched; the item must be noticeable
normally one won't need these. Luarocks should have taken care of these
Penlight is the battery for lua, like std
for C++ and Rust or core
for OCaml.
luarocks install penlight