diff --git a/README.md b/README.md index dae2bc4..a93a212 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,24 @@ You can also add the `--value` option to show just the value in the output (migh ## plist2profile -This tool is a modern re-interpretation of [Tim Sutton's mcxToProfile](https://github.com/timsutton/mcxToProfile). +This tool is a re-interpretation in Swift of [Tim Sutton's mcxToProfile](https://github.com/timsutton/mcxToProfile). It will convert a normal flat plist file into a custom mobileconfig/configuration profile that can be used for manual installation or with an MDM server. -In the simplest form, you use it like this: +In the simplest form, use it like this: ``` -% plist2profile --plist settings.plist --identifier com.example.settings +% plist2profile --identifier example.settings com.example.settings.plist ``` +This will generate a file named `example.settings.mobileconfig` in the current working directory which manages the preference keys in the `com.example.settings.plist` in the `com.example.settings` preference domain. You can add multiple plist files. + +The preference domain for the settings is determined from the file name of each plist file given (removing the `plist` file extension). + +You can add a display and organization name that will be used in the respective fields using the `--displayname` and `--organization` options. + +By default, the profile is created with a `System` scope. you can change it to `User` with the `--user` flag. + +There are two ways to assemble custom preference profile, the 'traditional' mcx format and a more modern format, which [Bob Gendler described in this post](https://boberito.medium.com/config-profile-and-manage-all-the-things-just-about-cafea8627d4b). This tool creates the modern format by default, but can also create the traditional format when you set the `--mcx` key. + + diff --git a/Sources/plist2profile/Plist2Profile.swift b/Sources/plist2profile/Plist2Profile.swift index 479ff70..f8ae263 100644 --- a/Sources/plist2profile/Plist2Profile.swift +++ b/Sources/plist2profile/Plist2Profile.swift @@ -17,11 +17,11 @@ struct Plist2Profile: ParsableCommand { version: "0.1" ) - // MARK: arguments,options, flags + // MARK: arguments, options, flags @Option( name: .shortAndLong, help: ArgumentHelp( - "the identifier for the profile", + "The identifier for the profile.", valueName: "identifier" ) ) @@ -29,39 +29,39 @@ struct Plist2Profile: ParsableCommand { @Argument( help: ArgumentHelp( - "Path to a plist to be added as a profile payload. Can be specified multiple times.", + "Path to a plist file to be added as a profile payload. Can be given more than once.", valueName: "plist" ) ) var plistPaths: [String] + @Option( + name: [.customShort("d"), .customLong("displayname")], + help: "Display name for the profile. (default: 'plist2profile: ')" + ) + var displayName = "" + @Option( name: [.customShort("g"), .customLong("organization")], - help: "Cosmetic name for the organization deploying the profile." + help: "Organization field for the profile." ) var organization = "" @Option( name: [.customShort("o"), .customLong("output")], - help: "Output path for profile. Defaults to 'identifier.mobileconfig' in the current working directory." + help: "Output path for profile. (default: '.mobileconfig')" ) var outputPath = "" - @Option( - name: [.customShort("d"), .customLong("displayname")], - help: "Display name for profile. Defaults to 'plist2profile: '." - ) - var displayName = "" - @Flag( name: .customLong("user"), - help: "sets the scope for the profile to 'User' (otherwise scope is 'System')" + help: "Sets the scope for the profile to 'User'. (default is 'System')" ) var userScope = false @Flag( name: .customLong("mcx"), - help: "creates the profile in macx format (default: modern)" + help: "Creates the profile in the traditional mcx format. (default: modern)" ) var mcx = false @@ -111,7 +111,7 @@ struct Plist2Profile: ParsableCommand { // if output is empty, generate file name if outputPath.isEmpty { - outputPath = identifier.appending(".mobileConfig") + outputPath = identifier.appending(".mobileconfig") } if userScope {