From c3d6af2471d705124de4c6e7aff443ba18d1248d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Sat, 27 Apr 2024 16:25:42 +0200 Subject: [PATCH] Make yaml2json a proper script --- bin/yaml2json | 4 ++++ zsh/zshrc.j2 | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100755 bin/yaml2json diff --git a/bin/yaml2json b/bin/yaml2json new file mode 100755 index 0000000..c0d130d --- /dev/null +++ b/bin/yaml2json @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 +import sys, yaml, json + +json.dump([d for d in yaml.safe_load_all(sys.stdin)][-1], sys.stdout, indent=4) diff --git a/zsh/zshrc.j2 b/zsh/zshrc.j2 index e4ae334..7de9501 100644 --- a/zsh/zshrc.j2 +++ b/zsh/zshrc.j2 @@ -131,7 +131,6 @@ alias twa="task add" alias twd="task done" alias inbox="task add +inbox" -alias yaml2json="python3 -c 'import sys, yaml, json; json.dump([d for d in yaml.safe_load_all(sys.stdin)][-1], sys.stdout, indent=4)'" alias json2yaml="python3 -c 'import sys, yaml, json; yaml.safe_dump(json.loads(sys.stdin.read()), stream=sys.stdout)'" alias currentbranch='git rev-parse --abbrev-ref HEAD'