[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] ob-shell: internal representation of cmdline arguments the sam
From: |
Ihor Radchenko |
Subject: |
Re: [BUG] ob-shell: internal representation of cmdline arguments the same |
Date: |
Wed, 01 May 2024 14:02:06 +0000 |
Max Nikulin <manikulin@gmail.com> writes:
> I consider it as a kind of pitfall inconsistent with DWIM concept. An
> idea of a kludge is below.
>
> #+begin_src sh :cmdline "1 2 3" :results verbatim
> printf '%s\n' "$@"
> #+end_src
> ...
> - (read cell))
> + (propertize (read cell) 'org-babel-value 'quoted-string))
> (t (org-no-properties cell))))
Well. See
https://list.orgmode.org/orgmode/87wmyc1sud.fsf@localhost/
>> Org cannot distinguish between
>>
>> #+begin_src lang :foo value with spaces
>> and
>> #+begin_src lang :foo "value with spaces"
>>
>> What we can do it make `org-babel-read' assign a text property to the
>> resulting string when it is a string with quotes:
>>
>> (org-babel-read "my file with quotes") ; => "my file with quotes"
>> (org-babel-read "\"my file with quotes\"") ; => #("my file with quotes"
0 19 (org-babel-quote t))
>>
>> Then, we can later use this information in `org-babel-merge-params'.
>> We will not call `split-string', when 'org-babel-quote text property is
>> present.
>> Also, `split-string' won't work when we have something like
>>
>> "yes \"my file with quotes\""
>>
>> Instead, we should use
>> (mapcar #'org-babel-read (org-babel-balanced-split "yes \"my file with
quotes\"" ?\s))
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>