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

Uses plutil or defaults to view binary property lists #2

Closed
wants to merge 3 commits into from

Conversation

Sesquipedalian
Copy link

Since pretty_plist can produce invalid output, it makes more sense to use plutil to create a legible version of a binary property list file, or even just defaults, and to fall back to pretty_plist only as a last resort.

If plutil is available, use it to convert the property list to XML format and then insert a warning to the user, either using perl if it is available, or else using bash's (much slower) regex engine. If plutil is not available, fall back to pretty_plist (TextMate's standard behaviour).
If XML representation is not possible because plutil is not available, use the defaults tool to get an old-style property list. Only use pretty_plist as a last resort, since it produces invalid output anyway.
@sorbits
Copy link
Member

sorbits commented Jul 14, 2020

The defaults command does not guarantee roundtrip safe output, therefore I don’t think it is an improvement over pretty_plist (which in general has nicer output).

XML is probably the only safe representation, if the goal is to be able to save the property list again (and not lose data), although strictly speaking, XML cannot contain control characters, but that might not be enforced.

Using XML though would limit the usefulness of this command, but there is of course ⌃⇧H to get to the ASCII representation.

Thoughts?

@Sesquipedalian
Copy link
Author

Since you've already implemented your own version of some of these changes, I will close this PR and submit new ones based on the current code. 🙂

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

Successfully merging this pull request may close these issues.

None yet

2 participants