User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
cs:yaml_formatter:start [2022/04/15 02:57]
Chris Nathman remove yaml formatting script
— (current)
Line 1: Line 1:
-====== YAML Formatting Script ====== 
  
-This script takes in a dumped parameter server and a file to overwrite with new values. It uses a yaml parser that keeps ordering and comments intact on read and write. 
- 
-===== Usage ===== 
-If you ever forget the usage of the script use ''​./​yaml_format -h''​. The script will also give the help if a parameter is missing. 
- 
-The basic usage is to dump the parameter server to a know location and to run the script. The script takes 2 inputs, the dumped parameter server and the file to overwrite with the values from the parameter server. The ''​%%--input%%''​ (''​-i''​ also works) parameter is the parameter server file and the ''​%%--output%%''​ (''​-i''​ also works) parameter is the file to overwrite in this case. For example: 
- 
-<​code>​ 
-./​yaml_format -i paramdump.yaml -o control.yaml 
-</​code>​ 
- 
-This will read in the ''​control.yaml''​ file into a data structure in the script and do the same for the ''​paramdump.yaml''​ file. Then the script will loop over the ''​paramdump.yaml''​ file and check if each key value pair exists in the file. If the pair exists in ''​control.yaml''​ it will be updated with the new value from ''​paramdump.yaml''​. This method ensures that random pairs aren't added to ''​control.yaml''​. 
- 
-Another usage of the script is to clean up a messy yaml file. This is done by making a copy of the yaml file and then running a command similar to the following: 
- 
-<​code>​ 
-./​yaml_format -i params_cpy.yaml -o params.yaml 
-</​code>​