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

Overriding values or inheriting from another plist #43

Open
Jon889 opened this issue Feb 13, 2020 · 1 comment
Open

Overriding values or inheriting from another plist #43

Jon889 opened this issue Feb 13, 2020 · 1 comment

Comments

@Jon889
Copy link

Jon889 commented Feb 13, 2020

We've come across a situation where we have a config that needs to be identical to another one (and stay identical if changes are made) except for one value

Currently I'm using plutil to override the value just before calling configen but this is quite hacky. So I see there are two options:

Allow overriding a key value on the command line, eg:

configen -p "$configLocation" -h "$configDir/Config.map" -n $configName -o "$configDir" --override KEY VALUE

Inheriting from another plist, eg:

baseconfig.plist

<dict>
  <key>KEY1</key>
  <string>VALUE1</string>
  <key>KEY2</key>
  <string>VALUE2</string>
</dict>

config.plist:

<dict>
  <key>:super</key>
  <string>baseconfig.plist</string>
  <key>KEY2</key>
  <string>NEW_VALUE2</string>
</dict>

The key of the base plist being something like :super, :inherit_from or :base etc. But starting with a character like : that makes it an invalid swift variable name.

That way the generated config.swift from config.plist is:

class Config {
  static let KEY1 = "VALUE1"
  static let KEY2 = "NEW_VALUE2"
}

I think the latter plist inheritance option would be preferable as it keeps all the values in the plists and there's no chance of one hiding in a script somewhere. Would this be desirable to implement and create a pull request?

@theblixguy
Copy link
Contributor

theblixguy commented Mar 2, 2020

I think it's a good idea, but have you considered having two plist files (and changing the values you want to be different in the other plist file) and switching between them?

(I'm sure you have, but just asking anyway. I am interesting in learning about the reasons why that is not preferable in your scenario, apart from things getting duplicated).

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

No branches or pull requests

2 participants