Andrew Geissler | 1753951 | 2019-06-24 15:52:30 -0500 | [diff] [blame] | 1 | #!/usr/bin/python3 |
| 2 | |
| 3 | # Copyright 2019 IBM Corp. |
| 4 | |
Andrew Geissler | 1753951 | 2019-06-24 15:52:30 -0500 | [diff] [blame] | 5 | from argparse import ArgumentParser |
| 6 | |
Patrick Williams | e310dd9 | 2022-12-07 06:55:38 -0600 | [diff] [blame^] | 7 | import yaml |
| 8 | |
| 9 | if __name__ == "__main__": |
Andrew Geissler | 1753951 | 2019-06-24 15:52:30 -0500 | [diff] [blame] | 10 | # A simple program to ensure proper indents of input yaml file |
| 11 | parser = ArgumentParser(description="YAML formatter") |
Patrick Williams | e310dd9 | 2022-12-07 06:55:38 -0600 | [diff] [blame^] | 12 | parser.add_argument( |
| 13 | "-f", "--file", dest="file_yaml", help="yaml file to format" |
| 14 | ) |
Andrew Geissler | 1753951 | 2019-06-24 15:52:30 -0500 | [diff] [blame] | 15 | args = parser.parse_args() |
| 16 | |
Patrick Williams | e310dd9 | 2022-12-07 06:55:38 -0600 | [diff] [blame^] | 17 | print( |
| 18 | yaml.dump( |
| 19 | yaml.load(open(args.file_yaml), Loader=yaml.FullLoader), indent=4 |
| 20 | ) |
| 21 | ) |