From: Cody Goodman <codygman.consulting@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Quoting of noweb references and variable noweb function arguments
Date: Sat, 12 Oct 2019 04:26:18 -0500 [thread overview]
Message-ID: <CADq_+R21j8FbsSf-VHtCb9JzsbDY54EZmPvBDD7TSLJWtEa0nA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]
I'm having an issue with quoting noweb functions. Since quote is used to
signify a variable being passed into the noweb syntax function call I
cannot put a quote around theno web function call and end up with invalid
bash.
I feel like I had this working at some point and it turned out that
:results value smartly handles quoting the values or something. I keep
seeming to run into the problem though of needing something like:
echo "<<nowebFunction(var1="variableOfCodeBlock")"
My org mode code complete with examples I hope are easy to understand are
at the bottom of this email.
Thanks,
Cody Goodman
* Function that mocks getting json with curl (typically I use restclient
blocks though or otherwise mix code blocks of differing languages)
** code
#+name: get-login-json-mock
#+begin_src sh :results value :var user="user1" pass="pass1" :noweb yes
echo "{\"loginToken\": \"hunter2\", \"user\": \"$user\", \"pass\":
\"$pass\"}"
#+end_src
#+RESULTS: get-login-json-mock
| loginToken": "hunter2 | user1 | pass1 |
** result: works fine
* pick out value from login json returned with jq
** code
#+name: get-login-json-value
#+begin_src sh :noweb yes :var logValUserVar="user2"
logValUserPass="pass2" jqExpr="[]keys"
json=<<get-login-json-mock(user="$logValUserVar",pass="$logValPassVar")>>
echo $json | jq $jqExpr
#+end_src
#+RESULTS: get-login-json-value
| sh: line 2: hunter2 | : command not found |
** result: sh: line 2: hunter2 | : command not found |
* get login token function using previous functions
** code
#+name: get-login-token
#+call:
get-login-json-value(logValUserVar="user3",logValUserPass="user3",".loginToken")
#+RESULTS: get-login-token
** result: nothing, because the previous step fails
[-- Attachment #2: Type: text/html, Size: 2159 bytes --]
next reply other threads:[~2019-10-12 9:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-12 9:26 Cody Goodman [this message]
2022-10-19 9:04 ` [O] Quoting of noweb references and variable noweb function arguments Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADq_+R21j8FbsSf-VHtCb9JzsbDY54EZmPvBDD7TSLJWtEa0nA@mail.gmail.com \
--to=codygman.consulting@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).