From 3635c712111f193ffc8a8709b02990bee3891e5f Mon Sep 17 00:00:00 2001 From: jhspetersson Date: Tue, 9 Apr 2024 09:00:21 +0200 Subject: update docs with IS_FONT and a few misc fixes --- docs/fselect.1 | 2 + docs/usage.md | 180 +++++++++++++++++++++++++++++---------------------------- src/main.rs | 2 +- 3 files changed, 94 insertions(+), 90 deletions(-) diff --git a/docs/fselect.1 b/docs/fselect.1 index 29b980d..dcd50a6 100644 --- a/docs/fselect.1 +++ b/docs/fselect.1 @@ -195,6 +195,8 @@ is_book .IP \(bu is_doc .IP \(bu +is_font +.IP \(bu is_image .IP \(bu is_source diff --git a/docs/usage.md b/docs/usage.md index f6ab2cf..e623786 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -56,87 +56,88 @@ Joins, unions, and subselects are not supported (yet?). ### Columns and fields -| Column | Meaning | Comment | -|----------------------------------------------| --- |---------------------------------------------------------------| -| `name` | Returns the name (with extension) of the file | | -| `extension` or `ext` | Returns the extension of the file | | -| `path` | Returns the path of the file | | -| `abspath` | Returns the absolute path of the file | | -| `directory` or `dirname` or `dir` | Returns the directory of the file | | -| `absdir` | Returns the absolute directory of the file | | -| `size` | Returns the size of the file in bytes | | -| `fsize` or `hsize` | Returns the size of the file accompanied with the unit | | -| `uid` | Returns the UID of the owner | | -| `gid` | Returns the GID of the owner's group | | -| `accessed` | Returns the time the file was last accessed (YYYY-MM-DD HH:MM:SS) | | -| `created` | Returns the file creation date (YYYY-MM-DD HH:MM:SS) | | -| `modified` | Returns the time the file was last modified (YYYY-MM-DD HH:MM:SS) | | -| `is_dir` | Returns a boolean signifying whether the file path is a directory | | -| `is_file` | Returns a boolean signifying whether the file path is a file | | -| `is_symlink` | Returns a boolean signifying whether the file path is a symlink | | -| `is_pipe` or `is_fifo` | Returns a boolean signifying whether the file path is a FIFO or pipe file | | -| `is_char` or `is_character` | Returns a boolean signifying whether the file path is a character device or character special file | | -| `is_block` | Returns a boolean signifying whether the file path is a block or block special file | | -| `is_socket` | Returns a boolean signifying whether the file path is a socket file | | +| Column | Meaning | Comment | +|----------------------------------------------|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------| +| `name` | Returns the name (with extension) of the file | | +| `extension` or `ext` | Returns the extension of the file | | +| `path` | Returns the path of the file | | +| `abspath` | Returns the absolute path of the file | | +| `directory` or `dirname` or `dir` | Returns the directory of the file | | +| `absdir` | Returns the absolute directory of the file | | +| `size` | Returns the size of the file in bytes | | +| `fsize` or `hsize` | Returns the size of the file accompanied with the unit | | +| `uid` | Returns the UID of the owner | | +| `gid` | Returns the GID of the owner's group | | +| `accessed` | Returns the time the file was last accessed (YYYY-MM-DD HH:MM:SS) | | +| `created` | Returns the file creation date (YYYY-MM-DD HH:MM:SS) | | +| `modified` | Returns the time the file was last modified (YYYY-MM-DD HH:MM:SS) | | +| `is_dir` | Returns a boolean signifying whether the file path is a directory | | +| `is_file` | Returns a boolean signifying whether the file path is a file | | +| `is_symlink` | Returns a boolean signifying whether the file path is a symlink | | +| `is_pipe` or `is_fifo` | Returns a boolean signifying whether the file path is a FIFO or pipe file | | +| `is_char` or `is_character` | Returns a boolean signifying whether the file path is a character device or character special file | | +| `is_block` | Returns a boolean signifying whether the file path is a block or block special file | | +| `is_socket` | Returns a boolean signifying whether the file path is a socket file | | | `is_hidden` | Returns a boolean signifying whether the file is a hidden file (e.g., files that start with a dot on *nix) | | -| `has_xattrs` | Returns a boolean signifying whether the file has extended attributes | | -| `capabilities` or `caps` | Returns a string describing Linux capabilities assigned to a file | Available only on Linux | -| `device` | (Linux only) Returns the code of device the file is stored on | | -| `inode` | (Linux only) Returns the number of inode | | -| `blocks` | (Linux only) Returns the number of blocks (256 bytes) the file occupies | | -| `hardlinks` | (Linux only) Returns the number of hardlinks of the file | | -| `mode` | Returns the permissions of the owner, group, and everybody (similar to the first field in `ls -la`) | | -| `user` | Returns the name of the owner for this file | Available only on *nix platforms with `users` feature enabled | -| `user_read` | Returns a boolean signifying whether the file can be read by the owner | | -| `user_write` | Returns a boolean signifying whether the file can be written by the owner | | -| `user_exec` | Returns a boolean signifying whether the file can be executed by the owner | | -| `user_all` | Returns a boolean signifying whether the file can be fully accessed by the owner | | -| `group` | Returns the name of the owner's group for this file | Available only on *nix platforms with `users` feature enabled | -| `group_read` | Returns a boolean signifying whether the file can be read by the owner's group | | -| `group_write` | Returns a boolean signifying whether the file can be written by the owner's group | | -| `group_exec` | Returns a boolean signifying whether the file can be executed by the owner's group | | -| `group_all` | Returns a boolean signifying whether the file can be fully accessed by the group | | -| `other_read` | Returns a boolean signifying whether the file can be read by others | | -| `other_write` | Returns a boolean signifying whether the file can be written by others | | -| `other_exec` | Returns a boolean signifying whether the file can be executed by others | | -| `other_all` | Returns a boolean signifying whether the file can be fully accessed by the others | | -| `suid` | Returns a boolean signifying whether the file permissions have a SUID bit set | | -| `sgid` | Returns a boolean signifying whether the file permissions have a SGID bit set | | -| `width` | Returns the number of pixels along the width of the photo or MP4 file | | -| `height` | Returns the number of pixels along the height of the photo or MP4 file | | -| `mime` | Returns MIME type of the file | | -| `is_binary` | Returns a boolean signifying whether the file has binary contents | | -| `is_text` | Returns a boolean signifying whether the file has text contents | | -| `line_count` | Returns a number of lines in a text file | | -| `exif_datetime` | Returns date and time of taken photo | | -| `exif_altitude` or `exif_alt` | Returns GPS altitude of taken photo | | -| `exif_latitude` or `exif_lat` | Returns GPS latitude of taken photo | | -| `exif_longitude` or `exif_lng` or `exif_lon` | Returns GPS longitude of taken photo | | -| `exif_make` | Returns name of the camera manufacturer | | -| `exif_model` | Returns camera model | | -| `exif_software` | Returns software name with which the photo was taken | | -| `exif_version` | Returns the version of EXIF metadata | | -| `mp3_title` or `title` | Returns the title of the audio file taken from the file's metadata | | -| `mp3_album` or `album` | Returns the album name of the audio file taken from the file's metadata | | -| `mp3_artist` or `artist` | Returns the artist of the audio file taken from the file's metadata | | -| `mp3_genre` or `genre` | Returns the genre of the audio file taken from the file's metadata | | -| `mp3_year` | Returns the year of the audio file taken from the file's metadata | | -| `mp3_freq` or `freq` | Returns the sampling rate of audio or video file | | -| `mp3_bitrate` or `bitrate` | Returns the bitrate of the audio file in kbps | | -| `duration` | Returns the duration of audio file in seconds | | -| `is_shebang` | Returns a boolean signifying whether the file starts with a shebang (#!) | | -| `is_empty` | Returns a boolean signifying whether the file is empty or the directory is empty | | -| `is_archive` | Returns a boolean signifying whether the file is an archival file | | -| `is_audio` | Returns a boolean signifying whether the file is an audio file | | -| `is_book` | Returns a boolean signifying whether the file is a book | | -| `is_doc` | Returns a boolean signifying whether the file is a document | | -| `is_image` | Returns a boolean signifying whether the file is an image | | -| `is_source` | Returns a boolean signifying whether the file is source code | | -| `is_video` | Returns a boolean signifying whether the file is a video file | | -| `sha1` | Returns SHA-1 digest of a file | | -| `sha2_256` or `sha256` | Returns SHA2-256 digest of a file | | -| `sha2_512` or `sha512` | Returns SHA2-512 digest of a file | | -| `sha3_512` or `sha3` | Returns SHA-3 digest of a file | | +| `has_xattrs` | Returns a boolean signifying whether the file has extended attributes | | +| `capabilities` or `caps` | Returns a string describing Linux capabilities assigned to a file | Available only on Linux | +| `device` | (Linux only) Returns the code of device the file is stored on | | +| `inode` | (Linux only) Returns the number of inode | | +| `blocks` | (Linux only) Returns the number of blocks (256 bytes) the file occupies | | +| `hardlinks` | (Linux only) Returns the number of hardlinks of the file | | +| `mode` | Returns the permissions of the owner, group, and everybody (similar to the first field in `ls -la`) | | +| `user` | Returns the name of the owner for this file | Available only on *nix platforms with `users` feature enabled | +| `user_read` | Returns a boolean signifying whether the file can be read by the owner | | +| `user_write` | Returns a boolean signifying whether the file can be written by the owner | | +| `user_exec` | Returns a boolean signifying whether the file can be executed by the owner | | +| `user_all` | Returns a boolean signifying whether the file can be fully accessed by the owner | | +| `group` | Returns the name of the owner's group for this file | Available only on *nix platforms with `users` feature enabled | +| `group_read` | Returns a boolean signifying whether the file can be read by the owner's group | | +| `group_write` | Returns a boolean signifying whether the file can be written by the owner's group | | +| `group_exec` | Returns a boolean signifying whether the file can be executed by the owner's group | | +| `group_all` | Returns a boolean signifying whether the file can be fully accessed by the group | | +| `other_read` | Returns a boolean signifying whether the file can be read by others | | +| `other_write` | Returns a boolean signifying whether the file can be written by others | | +| `other_exec` | Returns a boolean signifying whether the file can be executed by others | | +| `other_all` | Returns a boolean signifying whether the file can be fully accessed by the others | | +| `suid` | Returns a boolean signifying whether the file permissions have a SUID bit set | | +| `sgid` | Returns a boolean signifying whether the file permissions have a SGID bit set | | +| `width` | Returns the number of pixels along the width of the photo or MP4 file | | +| `height` | Returns the number of pixels along the height of the photo or MP4 file | | +| `mime` | Returns MIME type of the file | | +| `is_binary` | Returns a boolean signifying whether the file has binary contents | | +| `is_text` | Returns a boolean signifying whether the file has text contents | | +| `line_count` | Returns a number of lines in a text file | | +| `exif_datetime` | Returns date and time of taken photo | | +| `exif_altitude` or `exif_alt` | Returns GPS altitude of taken photo | | +| `exif_latitude` or `exif_lat` | Returns GPS latitude of taken photo | | +| `exif_longitude` or `exif_lng` or `exif_lon` | Returns GPS longitude of taken photo | | +| `exif_make` | Returns name of the camera manufacturer | | +| `exif_model` | Returns camera model | | +| `exif_software` | Returns software name with which the photo was taken | | +| `exif_version` | Returns the version of EXIF metadata | | +| `mp3_title` or `title` | Returns the title of the audio file taken from the file's metadata | | +| `mp3_album` or `album` | Returns the album name of the audio file taken from the file's metadata | | +| `mp3_artist` or `artist` | Returns the artist of the audio file taken from the file's metadata | | +| `mp3_genre` or `genre` | Returns the genre of the audio file taken from the file's metadata | | +| `mp3_year` | Returns the year of the audio file taken from the file's metadata | | +| `mp3_freq` or `freq` | Returns the sampling rate of audio or video file | | +| `mp3_bitrate` or `bitrate` | Returns the bitrate of the audio file in kbps | | +| `duration` | Returns the duration of audio file in seconds | | +| `is_shebang` | Returns a boolean signifying whether the file starts with a shebang (#!) | | +| `is_empty` | Returns a boolean signifying whether the file is empty or the directory is empty | | +| `is_archive` | Returns a boolean signifying whether the file is an archival file [(default extensions)](#ext_archive) | | +| `is_audio` | Returns a boolean signifying whether the file is an audio file [(default extensions)](#ext_audio) | | +| `is_book` | Returns a boolean signifying whether the file is a book [(default extensions)](#ext_book) | | +| `is_doc` | Returns a boolean signifying whether the file is a document [(default extensions)](#ext_doc) | | +| `is_font` | Returns a boolean signifying whether the file is a font [(default extensions)](#ext_font) | | +| `is_image` | Returns a boolean signifying whether the file is an image [(default extensions)](#ext_image) | | +| `is_source` | Returns a boolean signifying whether the file is source code [(default extensions)](#ext_source) | | +| `is_video` | Returns a boolean signifying whether the file is a video file [(default extensions)](#ext_video) | | +| `sha1` | Returns SHA-1 digest of a file | | +| `sha2_256` or `sha256` | Returns SHA2-256 digest of a file | | +| `sha2_512` or `sha512` | Returns SHA2-512 digest of a file | | +| `sha3_512` or `sha3` | Returns SHA-3 digest of a file | | ### Functions @@ -369,15 +370,16 @@ Assumptions are being made based on file extension. The lists below could be edited with the configuration file. -| Search field | Extensions | -| --- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `is_archive` | .7z, .bz2, .bzip2, .gz, .gzip, .lz, .rar, .tar, .xz, .zip | -| `is_audio` | .aac, .aiff, .amr, .flac, .gsm, .m4a, .m4b, .m4p, .mp3, .ogg, .wav, .wma | -| `is_book` | .azw3, .chm, .djv, .djvu, .epub, .fb2, .mobi, .pdf | -| `is_doc` | .accdb, .doc, .docm, .docx, .dot, .dotm, .dotx, .mdb, .odp, .ods, .odt, .pdf, .potm, .potx, .ppt, .pptm, .pptx, .rtf, .xlm, .xls, .xlsm, .xlsx, .xlt, .xltm, .xltx, .xps | -| `is_image` | .bmp, .exr, .gif, .heic, .jpeg, .jpg, .jxl, .png, .svg, .tga, .tiff, .webp | -| `is_source` | .asm, .bas, .c, .cc, .ceylon, .clj, .coffee, .cpp, .cs, .d, .dart, .elm, .erl, .go, .groovy, .h, .hh, .hpp, .java, .jl, .js, .jsp, .jsx, .kt, .kts, .lua, .nim, .pas, .php, .pl, .pm, .py, .rb, .rs, .scala, .sol, .swift, .tcl, .ts, .vala, .vb, .zig | -| `is_video` | .3gp, .avi, .flv, .m4p, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .webm, .wmv | +| Search field | Extensions | +|-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `is_archive` | .7z, .bz2, .bzip2, .gz, .gzip, .lz, .rar, .tar, .xz, .zip | +| `is_audio` | .aac, .aiff, .amr, .flac, .gsm, .m4a, .m4b, .m4p, .mp3, .ogg, .wav, .wma | +| `is_book` | .azw3, .chm, .djv, .djvu, .epub, .fb2, .mobi, .pdf | +| `is_doc` | .accdb, .doc, .docm, .docx, .dot, .dotm, .dotx, .mdb, .odp, .ods, .odt, .pdf, .potm, .potx, .ppt, .pptm, .pptx, .rtf, .xlm, .xls, .xlsm, .xlsx, .xlt, .xltm, .xltx, .xps | +| `is_font` | .eot, .fon, .otc, .otf, .ttc, .ttf, .woff, .woff2 | +| `is_image` | .bmp, .exr, .gif, .heic, .jpeg, .jpg, .jxl, .png, .svg, .tga, .tiff, .webp | +| `is_source` | .asm, .bas, .c, .cc, .ceylon, .clj, .coffee, .cpp, .cs, .d, .dart, .elm, .erl, .go, .groovy, .h, .hh, .hpp, .java, .jl, .js, .jsp, .jsx, .kt, .kts, .lua, .nim, .pas, .php, .pl, .pm, .py, .rb, .rs, .scala, .sol, .swift, .tcl, .ts, .vala, .vb, .zig | +| `is_video` | .3gp, .avi, .flv, .m4p, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .webm, .wmv | fselect is_archive, path from /home/user fselect is_audio, is_video, path from /home/user/multimedia diff --git a/src/main.rs b/src/main.rs index 63860d3..de1a7a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -364,10 +364,10 @@ Column Options: is_audio Returns a boolean signifying whether the file is an audio file is_book Returns a boolean signifying whether the file is a book is_doc Returns a boolean signifying whether the file is a document + is_font Returns a boolean signifying whether the file is a font file is_image Returns a boolean signifying whether the file is an image is_source Returns a boolean signifying whether the file is source code is_video Returns a boolean signifying whether the file is a video file - is_font Returns a boolean signifying whether the file is a font file sha1 Returns SHA-1 digest of a file sha2_256 | sha256 Returns SHA2-256 digest of a file -- cgit v1.2.3