hugosoucycc

[ARCHIVED] Another old source code of <hugo.soucy.cc>.
Log | Files | Refs | Submodules

commit 6d9def1744fa8ad000bcb7afd4910bfb8c811806
parent ea8188fc4971c23735b58f19ca6485effdf623de
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Sun, 17 Sep 2017 10:23:05 -0400

Delete an unused function

Diffstat:
Dfunctions/parse-yaml | 24------------------------
1 file changed, 0 insertions(+), 24 deletions(-)

diff --git a/functions/parse-yaml b/functions/parse-yaml @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -# Source: https://gist.github.com/pkuczynski/8665367#file-parse_yaml-sh - -parse_yaml() { - local prefix=$2 - local s - local w - local fs - s='[[:space:]]*' - w='[a-zA-Z0-9_]*' - fs="$(echo @|tr @ '\034')" - sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s[:-]$s\(.*\)$s\$|\1$fs\2$fs\3|p" "$1" | - awk -F"$fs" '{ - indent = length($1)/2; - vname[indent] = $2; - for (i in vname) {if (i > indent) {delete vname[i]}} - if (length($3) > 0) { - vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")} - printf("%s%s%s=(\"%s\")\n", "'"$prefix"'",vn, $2, $3); - } - }' | sed 's/_=/+=/g' -}