thommcgrath / Beacon

An editor for the beacons in Ark: Survival Evolved
https://usebeacon.app
GNU General Public License v3.0
50 stars 14 forks source link

Save .beacon file as pretty JSON for source tracking #45

Closed notyoyoma closed 7 years ago

notyoyoma commented 7 years ago

I'm working together with a few people on our .beacon file for our server. We're tracking our Game.ini stuff on Github.

Right now, whenever we make changes to the .beacon file, the diff looks like this: https://github.com/notyoyoma/arkini/commit/e13061a99fa537b18322cd51948381e83e8e1ae0#diff-b01e878c596f9ec39134a511a64785a5

Is there a way to save the JSON file as a pretty JSON file, so that the diffs are readable?

thommcgrath commented 7 years ago

That'd be great. Unfortunately, I don't have a way to do that. Xojo's Xojo.Data.GenerateJSON method unfortunately has no option for pretty printing. I'd have to write a converter. Which isn't completely outside the realm of possibility, but not a simple task either.

notyoyoma commented 7 years ago

Yeah, that makes sense.

Feel free to add that to a feature list if you feel it's useful. I might take a crack at it, time permitting.

thommcgrath commented 7 years ago

For what it's worth, I just tried an option to make this a reality, but it is MUCH too slow. Waiting a few seconds every save is not ok.

My recommendation in the short term is to just pipe the content through http://jsonprettyprint.com before you make your commit.

notyoyoma commented 7 years ago

Thanks! I found a web API to do the prettifying, so I added CURL API call to my make script: https://github.com/notyoyoma/arkini/blob/c9fe9a423024afd177160eb58c04524960e921c6/make.sh

Then I remembered that python has a JSON dumps method that can do pretty formatting. That made it a one-liner: https://github.com/notyoyoma/arkini/blob/master/make.sh

No API, no CURL

thommcgrath commented 7 years ago

I found a way. It'll be in the next build.