| Crates.io | findfile |
| lib.rs | findfile |
| version | 0.2.8 |
| created_at | 2023-06-20 16:30:03.519075+00 |
| updated_at | 2023-06-27 20:13:24.319837+00 |
| description | An ergonomic way to search for files |
| homepage | |
| repository | https://github.com/sampersand/FindFile |
| max_upload_size | |
| id | 895341 |
| size | 124,206 |
An simple, ergonomic, and powerful replacement for find.
"..."$/.../foo/*.txt12kb, 4.9mib$env vars and $1 cli vars+ in path literals start at the search root, not always at pwd root.-Xk and +Xk need to be implemented for larger & smaller^{} and ${} for begin and end blocksdepth and "amount of children in directory"Vec<u8> vs OsString vs String.${} for begin blocks and ${} for env varsHere's some examples of things I want to eventually support
ff 'isfile && depth=1' ff -n 'print "\t"*depth_from(start), basename'ff 'size > 1g || modify > -10d'-YYYY-MM-DD to all files but keep the extension: ff -n 'isfile && mv(file, "{dir}{base}-{ymd_date}.{suffix})'log: ff 'isfile && modify > -10d && basename(parent) = "log"'ff 'contents =~ /hello/ && contents =~ /world/'${} is run at script end): ff -n '${print maxdir} dirsize > dirsize(maxdir) then maxdir=dirsize'true equivalent to 1false equivalent to 0if else while continue break def return skip/next
If a function takes no arguments, you can just omit the parens. eg file? is the same as file?(),
as file?() is equivalent to file?(path).
| name and args | aliases | what it does |
|---|---|---|
file?(p=path) |
f? |
Returns whether p is a file. |
directory?(p=path) |
d? dir? |
Returns whether p is a directory. |
executable?(p=path) |
e? exe? |
Returns whether p is an executable. |
symlink?(p=path) |
s? sym? |
Returns whether p is a symlink. |
binary?(p=path) |
b? bin? |
Returns whether p is a binary file. |
gitignore?(p=path) |
gi? |
Returns whether p is ignored by a gitignore file. |
hidden?(p=path) |
gi? |
Returns whether p is starts with . |
ok?(msg) |
Prints msg out, then asks for confirmation. |
|
macos(...) |
future idea: stuff like macos tags or whatnot |
| root() | r | The root folder we started looking at |
| path() | p | The current path |
| dirname(p=path) | d dir parent | The parent directory |
| extname(p=path) | e ext extension | The extension, without a . if it's present |
| extnamed(p=path) | ed extd extensiond | The extension, including the . if it's present. |
| basename(p=path) | b bn base | Everything but the parent directory of p |
| stemname(p=path) | s stem | basename, except without an extension (if present) |
| print(...) | pr | Prints its arguments out (with nothing between them) followed by a newline |
| printn(...) | prn | Prints its arguments out (with nothing between them) without a newline |
| next | skip | Ignores the current argument and continues onwards |
| exit(status) | quit | stops the entire script |
| pwd() | Current working directory |
| depth(src=path, dst=root) | how many directories down we are from the dst. |
| date(<...>) | The current date foromatted in a time |
| sleep(<...>) | Sleeps |
Some of these functions are "destructive" (such as mv): If a destructive file would overwrite another one, it'll check the command line arguments to see what to do (--interactive implies always ask, --force implies never ask; if neither is given, --force is assumed.) You can use <fn>i to always do interactive or <fn>f to always force (like mvf).
All these must be called with parens (maybe?)
| name and args | what it does |
|---|---|
| exec(...) | .. |
mv{,f,i}(src=path, dst) |
Moves src to dst; only confirms if overwriting a file when interactive |
rm{,f,i}(src=path) |
Removes the file at src; always confirms when interactive. If given an empty directory, rm acts like rmdir. |
rmr{,f,i}(src=path) |
Removes the file at src, recursively; always confirms when interactive |
cp{,f,i}(src=path, dst) |
Copies src to dst only confirms if overwriting a file when interactive |
ln... |
|
mkdir(p) |
Creates a directory at p; It'll also make all parent directories. |
touch(src=path) |
Creates a directory at p; It'll also make all parent directories. |
there was a problem with moving your file. What would you like to do:
(Q)uit: Stop the entire program
(C)ontinue: continue onwards,
(R)etry: try it again (maybe after you fix something)
(S)hell: Drop you into a shell where $cpath is the variable for the current path