Created
          February 12, 2020 11:39 
        
      - 
      
- 
        Save bperel/64606610d0c8595adbb2258e5d55de7f to your computer and use it in GitHub Desktop. 
    Graphviz linter
  
        
  
    
      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
    
  
  
    
  | #/bin/bash | |
| # Usage : chmod +x graphviz-linter.sh && ./graphviz-linter.sh myfile.dot | |
| path=$1 | |
| output='' | |
| indent=0 | |
| while read line; do | |
| if [[ "${line:0:1}" = '}' ]]; then indent=$((indent - 1)); fi | |
| newLine='' | |
| for i in $(seq 1 $indent); do newLine+=' '; done | |
| newLine+="$line" | |
| output+="$newLine\n"; | |
| if [[ "${line: -1}" = '{' ]]; then indent=$((indent + 1)); fi | |
| done < $path | |
| echo -e "$output" > $path | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment