Replies: 2 comments
-
Workaround which i've got: find . -type d -name .git -execdir zsh -c ' export name=$(basename $(pwd)); export branches=$(git branch --remote --no-color | grep -v "origin/HEAD" | awk '"'"'{print $1}'"'"'); cat ../.repo.list.yml | yq '"'"'.[] | select(.name == env(name)) | . |= .branches=("${branches}" | envsubst | split("\n")) | [.] '"'"' '\; It's very ugly, but it works |
Beta Was this translation helpful? Give feedback.
0 replies
-
There isn't a way to exec into bash from yq atm - only other thing I can suggest is using a bash loop, like here: https://stackoverflow.com/questions/62898925/using-yq-in-for-loop-bash/70162342#70162342 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wanna build yaml doc, which is list of object, like
I use
gh
tool for build initial structure and getthen, add
branches
field withSo, the next step is to fill
branches
list and here is the question - is there a way to exec bash command, base on current context and use its output as value?, eg.it doesn't work like this obviously, but maybe there is some workaround?
yq can read env variables from current shell, but as war as i know, there is no callbacks|closures in bash, which may be used as env to evaluate.
Beta Was this translation helpful? Give feedback.
All reactions