Slice Posted July 21, 2022 Share Posted July 21, 2022 Still nobody created a plist editor able to compare two plists with mixed lines. Compare key by key, not line by line. For example Meld They looks to be different? No. They are different sorted. Is there any programmer? PS. The solution is https://www.insanelymac.com/forum/topic/352734-plist-comparison/?do=findComment&comment=2789715 5 Link to comment Share on other sites More sharing options...
Guest 5T33Z0 Posted July 21, 2022 Share Posted July 21, 2022 (edited) @Slice I don't know if that is what you are looking for but there's a plugin for Visual Studio Code called Diff Edited July 21, 2022 by 5T33Z0 Link to comment Share on other sites More sharing options...
Slice Posted July 21, 2022 Author Share Posted July 21, 2022 4 minutes ago, 5T33Z0 said: @Slice I don't know if that is what you are looking for but there's a plugin for Visual Studio Code called Diff No, Visual Studio has no relation to plist format liked by Apple. So this is just one more text compare. 2 Link to comment Share on other sites More sharing options...
joevt Posted July 22, 2022 Share Posted July 22, 2022 13 hours ago, Slice said: Still nobody created a plist editor able to compare two plists with mixed lines. Compare key by key, not line by line. For example Meld They looks to be different? No. They are different sorted. Is there any programmer? In BBEdit.app, I can find and replace to put all the values on the same line as their key. find: (</key>)\s+(<(string|integer|true/|false/|data)) replace: \1 \2 find: (<data>)\s+([^<]*?)\s+(</data>) replace: \1\2\3 You could make a perl script to do the same. After doing the find and replace, the plist remains as a valid plist file which OpenCore can still parse. I'm not sure about the plist parser in Clover. I remember it had some bugs and couldn't handle xml comments <!-- xml comment which you can use to describe important fields in the config.plist --> As for sorting, doesn't plutil or PListBuddy resort the dictionary keys for you? 1 Link to comment Share on other sites More sharing options...
Matgen84 Posted July 22, 2022 Share Posted July 22, 2022 18 hours ago, Slice said: Still nobody created a plist editor able to compare two plists with mixed lines. Compare key by key, not line by line. For example Meld They looks to be different? No. They are different sorted. Is there any programmer? Hi @Slice Have you seen Yousseb on GitHub. There is a fork of Meld packaged and bundled for OSX. This app is mentioned on official Meld site. Link to comment Share on other sites More sharing options...
Slice Posted July 22, 2022 Author Share Posted July 22, 2022 7 hours ago, joevt said: In BBEdit.app, I can find and replace to put all the values on the same line as their key. find: (</key>)\s+(<(string|integer|true/|false/|data)) replace: \1 \2 find: (<data>)\s+([^<]*?)\s+(</data>) replace: \1\2\3 You could make a perl script to do the same. After doing the find and replace, the plist remains as a valid plist file which OpenCore can still parse. I'm not sure about the plist parser in Clover. I remember it had some bugs and couldn't handle xml comments <!-- xml comment which you can use to describe important fields in the config.plist --> As for sorting, doesn't plutil or PListBuddy resort the dictionary keys for you? I can do this in C++ just have a few time for the work. I don't know how to use plutil or PListBuddy. I saw PlistEditorPro some version which always sorted plist after save. And I know application PlistEDPlus by ic005K which can sort one section, not enough. I asked him about comparing but no. Link to comment Share on other sites More sharing options...
joevt Posted July 25, 2022 Share Posted July 25, 2022 On 7/22/2022 at 6:31 AM, Slice said: I can do this in C++ just have a few time for the work. I don't know how to use plutil or PListBuddy. I saw PlistEditorPro some version which always sorted plist after save. And I know application PlistEDPlus by ic005K which can sort one section, not enough. I asked him about comparing but no. plutil and PListBuddy both have man pages. Right click the command in Terminal.app and select "Open man Page". Using plutil by itself, you can create a file, and add keys. Then you can manually scramble the keys. Then you can use plutil to sort the keys. plutil -create xml1 /tmp/myplist.plist plutil -insert "a" -dictionary /tmp/myplist.plist plutil -insert "a.a" -integer 123 /tmp/myplist.plist plutil -insert "a.z" -integer 123 /tmp/myplist.plist plutil -insert "a.m" -integer 123 /tmp/myplist.plist plutil -insert "b" -integer 123 /tmp/myplist.plist plutil -insert "z" -array /tmp/myplist.plist plutil -insert "z.0" -integer 789 /tmp/myplist.plist plutil -insert "z.1" -integer 456 /tmp/myplist.plist plutil -insert "z" -integer 333 -append /tmp/myplist.plist plutil -insert "z" -integer 111 -append /tmp/myplist.plist plutil -insert "x" -integer 123 /tmp/myplist.plist plutil -insert "m" -integer 123 /tmp/myplist.plist bbedit /tmp/myplist.plist # scrample the keys manually cp /tmp/myplist.plist /tmp/myplist_sorted.plist # copy the file plutil -convert xml1 /tmp/myplist_sorted.plist # sort the keys Notes: - plutil remove xml comments <!-- --> (which makes sense since there's no way to determine what key/value a comment belongs to unless it were placed between a key and value but even then plutil strips it because comments contain no data) - plutil does not sort arrays (which makes sense since the order in an array matters but the order in a dictionary doesn't matter) Regarding the regular expression idea, I would use a small perl script. perl -0777 -pE ' s!(</key>)\s+(<(string|integer|true/|false/|data))!$1 $2!g; s!(<data>)\s+([^<]*?)\s+(</data>)!$1$2$3!g; ' \ /tmp/myplist_sorted.plist > /tmp/myplist_sorted_for_compare.plist plutil can check that the format of the result is still correct for a plist. plutil /private/tmp/myplist_sorted_for_compare.plist /private/tmp/myplist_sorted_for_compare.plist: OK 2 1 Link to comment Share on other sites More sharing options...
Slice Posted July 25, 2022 Author Share Posted July 25, 2022 @joevt Big thanks! The command plutil -convert xml1 config.plist is that I dreamed I converted my config.plist and config-sample.plist and really see the difference. sergey@iMac PCompare % plutil -convert xml1 configImacPro.plist sergey@iMac PCompare % plutil -convert xml1 config-sample.plist The application is DiffFork.app. It is free(?), worked in Ventura as well. Link to comment Share on other sites More sharing options...
Slice Posted July 25, 2022 Author Share Posted July 25, 2022 Check after sorting sergey@iMac PCompare % /Users/sergey/src/CloverBootloader/CloverPackage/CloverConfigPlistValidator/ccpv /Users/sergey/Desktop/PCompare/config-sample.plist Your plist looks good. Well done! sergey@iMac PCompare % Link to comment Share on other sites More sharing options...
iCanaro Posted July 25, 2022 Share Posted July 25, 2022 26 minutes ago, Slice said: The application is DiffFork.app. It is free(?), https://www.macupdate.com/app/mac/33167/difffork Link to comment Share on other sites More sharing options...
Slice Posted July 25, 2022 Author Share Posted July 25, 2022 8 minutes ago, iCanaro said: https://www.macupdate.com/app/mac/33167/difffork Shareware but abandoned so free. Link to comment Share on other sites More sharing options...
Cyberdevs Posted July 25, 2022 Share Posted July 25, 2022 @Slice I'm usually using BeyondCompare when I want to compare config files. The app clearly does more than that so I thought you might wanna check it out. Link to comment Share on other sites More sharing options...
Slice Posted July 25, 2022 Author Share Posted July 25, 2022 14 minutes ago, Cyberdevs said: @Slice I'm usually using BeyondCompare when I want to compare config files. The app clearly does more than that so I thought you might wanna check it out. There are many text compare applications. Most of them are not free. This one is free for 30 days. And comparison is not very good Link to comment Share on other sites More sharing options...
Cyberdevs Posted July 25, 2022 Share Posted July 25, 2022 Nope it's not free Link to comment Share on other sites More sharing options...
joevt Posted July 25, 2022 Share Posted July 25, 2022 I use BBEdit.app. It's not too expensive and I like running terminal commands in BBEdit worksheets (like MPW). What about Apple's FileMerge.app which you can find inside Xcode.app? Or p4merge.app, part of the Helix Visual Client (P4V) from Perforce? https://www.perforce.com/downloads/helix-visual-client-p4v Link to comment Share on other sites More sharing options...
Slice Posted July 26, 2022 Author Share Posted July 26, 2022 10 hours ago, Slice said: @joevt Big thanks! The command plutil -convert xml1 config.plist is that I dreamed I converted my config.plist and config-sample.plist and really see the difference. sergey@iMac PCompare % plutil -convert xml1 configImacPro.plist sergey@iMac PCompare % plutil -convert xml1 config-sample.plist The application is DiffFork.app. It is free(?), worked in Ventura as well. It's a pity this is not full solution because commented out lines float up in the dictionary whle it will be better to keep original order ignoring # sign. Link to comment Share on other sites More sharing options...
Slice Posted July 26, 2022 Author Share Posted July 26, 2022 Meld is opensourcered but unsupported in OSX. Anyway it works https://meldmerge.org Again it is just text comparing. Link to comment Share on other sites More sharing options...
joevt Posted July 26, 2022 Share Posted July 26, 2022 8 hours ago, Slice said: It's a pity this is not full solution because commented out lines float up in the dictionary whle it will be better to keep original order ignoring # sign. Can't the # sign be put at the end of the name? The point is to make the name not the same as a valid name, so any change should work. Link to comment Share on other sites More sharing options...
Slice Posted July 26, 2022 Author Share Posted July 26, 2022 2 hours ago, joevt said: Can't the # sign be put at the end of the name? The point is to make the name not the same as a valid name, so any change should work. Yes, I also think about this. Some manual work required for the best future... There is more logical to put sign "?" at the end of the key meaning "Ask Clover to choose a default calculated value". @ CloverConfigurator Maintainers. It will be good if you'll implement the sign "?" to be written into a key value with the same meaning as I said. Link to comment Share on other sites More sharing options...
Recommended Posts