ionic-team/trapeze

Wrong output for ios -> "CFBundleDocumentTypes"

Timbuktu1982 opened this issue · 4 comments

Hi there,
what went wrong?

yaml:

  - replace: true
    entries:
        - CFBundleDocumentTypes:
            - CFBundleTypeName: PDF
            - LSHandlerRank: Alternate
            - LSItemContentTypes:
                  - com.adobe.pdf

output:

	<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeName</key>
			<string>PDF</string>
		</dict>
		<dict>
			<key>LSHandlerRank</key>
			<string>Alternate</string>
		</dict>
		<dict>
			<key>LSItemContentTypes</key>
			<array>
				<string>com.adobe.pdf</string>
			</array>
		</dict>
	</array>

expected output:

<key>CFBundleDocumentTypes</key>
	<array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>PDF</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>com.adobe.pdf</string>
            </array>
        </dict>
	</array>

Note: you can use three backticks and the name of the language to syntax highlight code blocks.

For this, just look at the shape of your yaml:

  - replace: true
    entries:
        - CFBundleDocumentTypes:
            - CFBundleTypeName: PDF
            - LSHandlerRank: Alternate
            - LSItemContentTypes:
                  - com.adobe.pdf

This creates an object of the shape:

[
  {
     "CFBundleDocumentTypes": [
       { "CFBundleTypeName": },
     ]
  }
]

If you want a different shape, change the yaml:

  - replace: true
    entries:
        - CFBundleDocumentTypes:
            CFBundleTypeName: PDF
            LSHandlerRank: Alternate
            LSItemContentTypes:
                - com.adobe.pdf

Great. Thank you very much for the quick support!

Sorry, i was to fast with closing...
The inner object is correctly now. But i miss the array outside.

yaml:

                    - replace: true
                      entries:
                          - CFBundleDocumentTypes:
                                CFBundleTypeName: PDF
                                LSHandlerRank: Alternate
                                LSItemContentTypes:
                                    - com.adobe.pdf

output:

<key>CFBundleDocumentTypes</key>
	<dict>
		<key>CFBundleTypeName</key>
		<string>PDF</string>
		<key>LSHandlerRank</key>
		<string>Alternate</string>
		<key>LSItemContentTypes</key>
		<array>
			<string>com.adobe.pdf</string>
		</array>
	</dict>

expected output:

<key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>PDF</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>com.adobe.pdf</string>
            </array>
        </dict>
	<array/>

Ah ok, i have adjust the shape like this and it works great. THX

                    - replace: true
                      entries:
                          - CFBundleDocumentTypes:
                                - CFBundleTypeName: PDF
                                  LSHandlerRank: Alternate
                                  LSItemContentTypes:
                                      - com.adobe.pdf