From ccd9ffb85800be3614be7a4d6ed36013982dc2ed Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Wed, 24 Jan 2024 18:51:03 -0500 Subject: add to docs and add test case --- wordpress/export-json.bash | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/wordpress/export-json.bash b/wordpress/export-json.bash index 3438821..fa1f41e 100644 --- a/wordpress/export-json.bash +++ b/wordpress/export-json.bash @@ -9,7 +9,7 @@ # Example: # # $ ( -# source export-json.bash +# source export-json.bash && # export_JSON SSH_TTY \ # SSH_CONNECTION \ # SSH_CLIENT \ @@ -35,7 +35,8 @@ # Variable names are given to the function as its # argument list: # -# $ (source export-json.bash; export_JSON PATH) +# $ source export-json.bash && +# export_JSON PATH # # The output is a single JSON object containing # key-value mappings between JSON strings: @@ -44,6 +45,15 @@ # "PATH": "/usr/local/sbin:[...]" # } # +# It is possible to use a different name for the +# variable in the JSON object key field than in +# the shell environment, like this: +# +# $ export_JSON DBUS_SESSION_BUS_ADDRESS=p +# { +# "p": "unix:path=/run/user/1000/bus" +# } +# # It uses the external tool "jq" to parse string # values placed in jq's argument list by bash and # then encode them as JSON string values. This @@ -137,4 +147,5 @@ runtest() try export_JSON try export_JSON '' try export_JSON '' SSH_TTY + try export_JSON SSH_TTY '' } -- cgit v1.2.3