Closed stuaxo closed 4 years ago
What have you tried?
I got as far as
$ yq r .travis.yml addons.apt.packages | cut -f2 -d\ | tr '\n' ' '
But wondering if there is a more native solution.
You are in the wrong repo; you are looking for another utility by the same name.
With yq, apt-get install $(yq -r .addons.apt.packages[] ~/projects/query-service/.travis.yml)
works. If you must get a space separated string, I would do for i in $(yq ...); do echo -n "$i "
.
The square bracket syntax doesn't work for me, maybe my travis is in a different format:
https://github.com/shoebot/shoebot/blob/master/.travis.yml
I can't work out how to get the square bracket syntax to work.
Using $()
works, though I would still get lots of -
. so will need to use cut
:
echo $(yq r .travis.yml addons.apt.packages) build-essential - gir1.2-gtk-3.0 - gir1.2-rsvg-2.0 - gobject-introspection - libgirepository1.0-dev - libglib2.0-dev - libjpeg-dev - libpango1.0-dev - python-gi-cairo - python-gobject - python3-dev
I'll do this in a python script in the end, cheers for the help.
Apologies, just saw your comment about this being the wrong repo.
Arg, sorry about that !
I'd like to compare the some content in a yaml file with a list I already have in an environment variable, seperated by spaces.
Is there a way I can get the list of item values output on a single line by yq ?