Bedrock-OSS / regolith

Bedrock Addons compiler pipeline.
https://bedrock-oss.github.io/regolith/
MIT License
60 stars 17 forks source link

Add `--profile` flag to `install` subcommand #261

Closed stirante closed 1 year ago

stirante commented 1 year ago

This is a simple change, that adds 1 flag:

  1. --profile (or -p) - Adds installed filters to the specified profiles. If no profile is provided, the filters will be added to the default profile

Examples:

# Just install filter
regolith install <filter>
# Install and add to default profile
regolith install --profile <filter>
# Install and add to test profile
regolith install --profile=test <filter>
# Install and add to test and default profiles
regolith install --profile=test,default <filter>

Additionally I implemented finding values in JSON by simple path. It's not actually JSONPath, but more like a file path. It's a utility function to get around long blocks of getting value, checking if it exists and checking the type.

SirLich commented 1 year ago

Going to push this a bit further. Why have two flags?

Why not like:

  1. regolith install --profile (adds to default profile)
  2. regolith install (installs, maybe prints a warning, saying you need to manually place the filter into a profile?)
  3. regolith install --profile box (adds into box profile)
  4. regolith install --profile test dev (adds into two profiles)

This feels fully featured, and we don't need 'add' at that point.

stirante commented 1 year ago

I wanted to make it one flag, but I couldn't find a way with our CLI library to do so

Nusiq commented 1 year ago

I suggested it to be this way because as far as I know the solution with only one flag might be impossible.

stirante commented 1 year ago

Actually maybe it could be possible with https://github.com/spf13/pflag#setting-no-option-default-values-for-flags