Added jq and yq testers

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
Marcus Noble 2023-04-04 08:39:24 +01:00
parent b0a62568e9
commit 1cd2abbcc4
Signed by: AverageMarcus
GPG Key ID: B8F2DB8A7AEBAF78
2 changed files with 74 additions and 0 deletions

37
home/.bin/jq-test Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env bash
source .utils
print_usage() {
orange "jq-test - interactively use JQ against a json file"
echo " "
underline "Usage:"
echo "jq-test [FILE]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
POS_ARGS+=$1
shift
;;
esac
done
if [ ${#POS_ARGS[@]} -eq 0 ]
then
print_usage
exit 0
fi
echo '' | fzf --preview "jq {q} < ${POS_ARGS[@]}"

37
home/.bin/yq-test Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env bash
source .utils
print_usage() {
orange "yq-test - interactively use YQ against a json file"
echo " "
underline "Usage:"
echo "yq-test [FILE]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
POS_ARGS+=$1
shift
;;
esac
done
if [ ${#POS_ARGS[@]} -eq 0 ]
then
print_usage
exit 0
fi
echo '' | fzf --preview "yq {q} < ${POS_ARGS[@]}"