organize icon indicating copy to clipboard operation
organize copied to clipboard

Define a repo for rules

Open rafo opened this issue 3 years ago • 3 comments

Dont reinvent the wheel...

...and let users contribute their rules to a separate repo / website.

Solution

  • Define some rules (naming, file endings, utf-8, etc. pp)
  • Gather some volunteers to check for malitious code.
  • Create a website with search ,filters and ratings
  • Profit ;D

Possible match in your Roadmap https://github.com/tfeldmann/organize/projects/4#card-25088440

rafo avatar Jun 04 '22 17:06 rafo

Good idea. Creating a website for this is a bit too much but a folder with some predefined rules would certainly be useful and could live in this repository. Goes on the todo list.

tfeldmann avatar Aug 03 '22 16:08 tfeldmann

I'm having a hard time defining what these predefined rules might look like. Maybe something like snippets?

description: "Filters images containing GPS information"
type: "filter"
---
- exif: gps.gpsdate
description: "Recursively delete all empty directories"
type: "rule"
---
rules:
  - locations: "__placeholder__"
    targets: dirs
    subfolders: true
    filters:
      - empty
    actions:
      - delete

Any good ideas?

tfeldmann avatar Aug 25 '23 15:08 tfeldmann

I haven't fully thought this through, but one idea might be to allow these standalone rules to be 'include'd into the main config, and you pass any required variables to it (copying this idea from ansible)

So your generic 'blueprint' might be defined as..

description: "Recursively delete all empty directories"
type: "blueprint"
---
rules:
  - locations: "{{ vars.dir }}"
    targets: dirs
    subfolders: true
    filters:
      - empty
    actions:
      - delete

and then you include the blueprint from your main config like...

description: "Recursively delete all empty directories"
type: "rule"
include:
  file: blueprints/recursively_delete.yml
  vars:
    - dir: ~/Desktop/some_dir

It could then generate an error if vars.dir was not defined

It's possible this is overkill though. Perhaps a dir of example rules might be enough, and then users can simply edit them and paste them into main config.

I like the idea of generic rules you can plug in, but I wonder how often they would be used in practice

carpii avatar Jan 13 '24 00:01 carpii