The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 line
830 B

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. # Print all values for a JSON property name, among any given JSON via stdin.
  6. # JSON could be object, array, nested objects, etc.
  7. #
  8. # Note that this command redirects stderr to /dev/null, so it might mask errors.
  9. # If you get empty results when you expect something there, check the output of the command
  10. # before piping to jq-all-vals to verify
  11. #
  12. # Usage:
  13. #
  14. # some-command-that-produces-JSON | jq-all-vals prop-name
  15. #
  16. # prop-name : a property name
  17. #
  18. SCRIPT="${0}"
  19. SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
  20. . "${SCRIPT_DIR}"/bubble_common
  21. ARG="${1:?no property provided}"
  22. jq -r 'getpath(path(.. | select(.'"${ARG}"' != null))) | .'"${ARG}"'' 2> /dev/null