Skip to content

Commit

Permalink
updated readme and help texts
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptingosx committed Mar 21, 2024
1 parent bde5a16 commit 7cf0693
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


28 changes: 14 additions & 14 deletions Sources/plist2profile/Plist2Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,51 @@ 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"
)
)
var identifier: String

@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: <identifier>')"
)
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: '<identifier>.mobileconfig')"
)
var outputPath = ""

@Option(
name: [.customShort("d"), .customLong("displayname")],
help: "Display name for profile. Defaults to 'plist2profile: <first domain>'."
)
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

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 7cf0693

Please sign in to comment.