Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define a repo for rules #217

Open
rafo opened this issue Jun 4, 2022 · 3 comments
Open

Define a repo for rules #217

rafo opened this issue Jun 4, 2022 · 3 comments

Comments

@rafo
Copy link

rafo commented Jun 4, 2022

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

@tfeldmann
Copy link
Owner

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
Copy link
Owner

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?

@carpii
Copy link

carpii commented Jan 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants