knurling / ServiceStation

Service Station
37 stars 1 forks source link

Allow More Complex Rule Sets. #22

Closed JWShroyer closed 4 years ago

JWShroyer commented 4 years ago

When creating a custom rule, it would be nice to have the ability to combine top-level rules. For instance, combining a section of "None of the following" with "All of the following" rules. Currently you can only create a set of rules that fall under one of these categories instead of having more complex rules.

A rule that I'm currently trying to create is one that allows me to show options where the selected item is NOT a Directory type and also has an empty extension. I want to show my favorite text editor when selecting a file like Cartfile or Podfile for my iOS development.

pkamb commented 4 years ago

If you hold the Option key when pressing the "+" button I believe you'll get what you need today:

Screen Shot 2020-04-23 at 2 38 13 PM

I agree that it's hard to find that option. Surprised me the first time I used it.

Service Station uses the same tech as the predicate-based search in Finder, so any tips like this that apply there should work in Service Station as well.

By default, when you add new criteria to a search, the Finder will do so with And logic, meaning that files must meet all of the criteria to be included in the results. However, you might wish to specify files by excluding some criteria—by using a Not logical statement. You can implement such advanced search logic by holding the Option key down when you click the plus button to add a new criterion. When you do so, the new criterion will appear with a second line before it, which gives you the option of Any, All, or None, to specify how the new criterion (or additional criteria) will be handled in the new search.

https://www.macworld.com/article/2461480/four-finder-timesavers-every-smart-mac-user-should-know.html

Service Station uses NSPredicateEditor's compound nesting mode:

NSRuleEditorNestingModeCompound Unlimited nesting and compound rows.

JWShroyer commented 4 years ago

This is great! Thank you! This gives me exactly what I want! I'll close this issue. :)

pkamb commented 4 years ago

I'm also thinking about how to target "unknown" file types directly. I want to do the same thing, add a Text editor for random dotfiles and such in my dev directories.

I'll link that Issue here when I make it. Not sure if there's a good way to do it in the current predicate editor, but I think there are a few fields I can add.