massivebird / arcsearch

Digital game archive querying tool
GNU General Public License v3.0
0 stars 1 forks source link

Only query specified systems #7

Closed massivebird closed 10 months ago

massivebird commented 11 months ago

Queries could be constrained to only query specific systems, specified by label.

For example:

# config.yaml
systems:
  myds: # system "label"
    display_name: "DS"
    color: [135,215,255]
    path: "ds"
    games_are_directories: false
  # more systems...

If I only wanted to search through my DS games, I could hypothetically do something like this:

arcsearch --systems="myds" "mario"
massivebird commented 11 months ago

I think I can parse the command line arguments, then invoke arcconfig::read_config like so:

// basically pseudocode

let desired_labels: Vec<&str> = vec!["ds", "snes"];

let systems: Vec<System> = read_config(&config.archive_root).drain_filter(
    |s| desired_labels.contains(s.label)
);

Note that this would require a new property, label, to be added to arcconfig::System. I might have to rewrite its core logic to gain access to system labels.

Arcconfig added this property as of 0.2.0!

This could be accomplished inside arcconfig, but then we would have to pass in our parsed command line arguments, and then I have to establish standardized argument types, and that gets messy. I want to delegate all command line argument handling to arcconfig implementers.