Skip to content

Overriding values or inheriting from another plist #43

@Jon889

Description

@Jon889

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions