diff --git a/docs/ptsd.json.5.scd b/docs/ptsd.json.5.scd new file mode 100644 index 0000000..9520195 --- /dev/null +++ b/docs/ptsd.json.5.scd @@ -0,0 +1,95 @@ +PTSD.JSON(5) "git.sr.ht/~hauleth/ptsd" "File Formats Manual" + +# NAME + +ptsd.json - actions specification for _ptsd_(1) + +# SYNTAX + +The file should use JSON format with array as a top-level value. Entries of +these values should be objects containing at least these fields: + +*location* + Directory which will be read for files. + +*filter* + Object that defines filter that will select files on which actions will + be performed. See _FILTERS_. + +*actions* + Array of actions to be performed on files. Actions will be performed + from top to bottom. *Moves are not followed*. See _ACTIONS_. + +# FILTERS + +Filters are in form: + + {"type": "", } + +Available filters are + +*name* + Match name of the file against pattern. Available options (exclusive): + + - *exact* - match name exactly + - *wildcard* - match name agains wildcard pattern + - *regex* - match name against regular expression + +*file_type* + Match OS type of the file. + + Options: + + - *is* - string that can be one of *dir*, *file*, *symlink* and will + return if subject of the test point to file of that type + +*content_type* + Match agains content type. + + Options: + + - *mime* - will try to deduce MIME type of the file and will look for + exact match + - *magic* - object with field *bytes* that is array of integers within + range 0..255 that describe magic bytes that will be read from the file + and matched. Optionally there can be also used option *offset* that + describes offset from the beginning of the file for the pattern. + +There are also meta filters: + +*not* + Takes one option *filter* and returns success if filter failed and vice + versa. + +*all* + Takes one option *filters* which is a list of filters and will succeed + if and only if all filters in list are successful match. + +*any* + Takes one option *filters* which is a list of filters and will succeed + if any of filters in list is successful match. + +# ACTIONS + +Current set of actions that are supported: + +*{"script": ""}* + Execute script located at __ with file name in the question passed + as first argument. + +*{"move": ""}* + Move file to directory pointed by the __. + +*{"echo": ""}* + Show __ next to the filename. + +*"trash"* + Move file to trash in platform dependant way. + +# AUTHORS + +Created and maintained by: Ɓukasz Niemier <#@hauleth.dev>++ +Sources available at: ++ +Patches and bug reports: <~hauleth/public-inbox@lists.sr.ht> + +; vim: noexpandtab diff --git a/flake.nix b/flake.nix index b159667..93d7b1a 100644 --- a/flake.nix +++ b/flake.nix @@ -40,7 +40,7 @@ }; packages = - [] + [pkgs.scdoc] ++ pkgs.lib.lists.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [ frameworks.Foundation pkgs.libiconv