Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong output for ios -> "CFBundleDocumentTypes" #162

Closed
Timbuktu1982 opened this issue Jan 26, 2023 · 4 comments
Closed

Wrong output for ios -> "CFBundleDocumentTypes" #162

Timbuktu1982 opened this issue Jan 26, 2023 · 4 comments

Comments

@Timbuktu1982
Copy link

Timbuktu1982 commented Jan 26, 2023

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>
@mlynch
Copy link
Contributor

mlynch commented Jan 26, 2023

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

@Timbuktu1982
Copy link
Author

Great. Thank you very much for the quick support!

@Timbuktu1982
Copy link
Author

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/>

@Timbuktu1982
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants