@@ -62,7 +62,6 @@ struct Plist2Profile: ParsableCommand {
62
62
var payloadScope = " System " // or "User"
63
63
64
64
// TODO: missing keys for profile
65
- // payload scope
66
65
// removal disallowed
67
66
// removalDate, duration until removal
68
67
// description
@@ -123,8 +122,8 @@ struct Plist2Profile: ParsableCommand {
123
122
// payload keys
124
123
payload [ " PayloadIdentifier " ] = plistname
125
124
payload [ " PayloadType " ] = plistname
126
- payload [ " PayloadDisplayName " ] = " \( displayName) : \( plistname ) "
127
- payload [ " PayloadUUID " ] = payloadUUID. description
125
+ payload [ " PayloadDisplayName " ] = displayName
126
+ payload [ " PayloadUUID " ] = payloadUUID. uuidString
128
127
payload [ " PayloadVersion " ] = payloadVersion
129
128
130
129
if !organization. isEmpty {
@@ -140,12 +139,10 @@ struct Plist2Profile: ParsableCommand {
140
139
try validatePlists ( )
141
140
populateDefaults ( )
142
141
143
- print ( " Hello, plist2profile! " )
144
-
145
- // Boilerplate
142
+ // Boilerplate keys
146
143
let profileDict : NSMutableDictionary = [
147
144
" PayloadIdentifier " : identifier,
148
- " PayloadUUID " : uuid. description ,
145
+ " PayloadUUID " : uuid. uuidString ,
149
146
" PayloadVersion " : payloadVersion,
150
147
" PayloadType " : payloadType,
151
148
" PayloadDisplayName " : displayName,
@@ -162,13 +159,14 @@ struct Plist2Profile: ParsableCommand {
162
159
let payload = try createModernPayload ( plistPath: plistPath)
163
160
payloads. add ( payload)
164
161
165
- // insert payloads array
166
- profileDict [ " PayloadContent " ] = payloads
167
162
}
168
-
169
- guard let plistData = try ? PropertyListSerialization . data ( fromPropertyList: profileDict, format: . xml, options: . zero)
170
- else { try exit ( " could generate property list " , code: 73 ) }
171
-
172
- print ( String ( data: plistData, encoding: . utf8) ?? " <no data> " )
163
+
164
+ // insert payloads array
165
+ profileDict [ " PayloadContent " ] = payloads
166
+
167
+ let profileURL = URL ( filePath: identifier)
168
+ . appendingPathExtension ( " mobileconfig " )
169
+ try profileDict. write ( to: profileURL)
170
+ print ( profileURL. relativePath)
173
171
}
174
172
}
0 commit comments