Browse Source

Add YAML quick validator

Alois Mahdal 5 years ago
parent
commit
090dfaed72
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      dotfiles/bash/main.bashrc

+ 8
- 0
dotfiles/bash/main.bashrc View File

@@ -83,6 +83,14 @@ twice() {
83 83
     "$@"
84 84
 }
85 85
 
86
+ckyaml() {
87
+    #
88
+    # Check if YAML file $1 is loadable
89
+    #
90
+    local yfile=$1
91
+    python -c 'import yaml; import sys; print(yaml.load(sys.stdin)["this"])' <"$yfile"
92
+}
93
+
86 94
 git() {
87 95
     #
88 96
     # /usr/bin/git wrapper just to disable dangerous commands