Last active
February 27, 2025 11:19
-
-
Save kastoestoramadus/c2231678277658cba0bcfca84106c952 to your computer and use it in GitHub Desktop.
python script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import ddpyhocon | |
| def format_hocon(input_file, output_file): | |
| with open(input_file, 'r') as infile: | |
| # Parse the HOCON file into a Python dictionary | |
| config = ddpyhocon.ConfigFactory.parse_file(infile) | |
| with open(output_file, 'w') as outfile: | |
| # Write the formatted HOCON file | |
| config.save(outfile, pretty=True) # pretty=True enables pretty printing | |
| if __name__ == "__main__": | |
| # You can pass the input and output file paths as arguments | |
| input_path = sys.argv[1] | |
| output_path = sys.argv[2] | |
| format_hocon(input_path, output_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment