浏览代码

Add YAML quick validator

Alois Mahdal 6 年前
父节点
当前提交
090dfaed72
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8
    0
      dotfiles/bash/main.bashrc

+ 8
- 0
dotfiles/bash/main.bashrc 查看文件

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
 git() {
94
 git() {
87
     #
95
     #
88
     # /usr/bin/git wrapper just to disable dangerous commands
96
     # /usr/bin/git wrapper just to disable dangerous commands