Open ohobby opened 1 year ago
@ohobby I made short patch and sent PR as #6.
Hi @itaru2622 it's a step further and you can already do more with it, but it would be much better if you could use \n. I would like to create a bot with which I can post certain measured values. The text is assembled in a script (and formatted with the line break) and completed with the values. At the end, the text is in a variable, which is then used for the output.
@ohobby by my PR, you can pass any text to create_bsky_post.py via pipe as below.
commandofmeasurement | create_bsky_post.py --options
@ohobby
even with current main branch (without my PR), you can also pass multi-line text by using quote and ENTER-key as below. but as I described above, pipe with my PR is easier than below to integrate with other software.
# current main branch (without my PR)
create_bsky_post.py --options 'first line<ENTER>
second line<ENTER>
more lines<ENTER>
'
newline char ('\n') in text is escaped to '\\n'
by standard json library while it makes json object from text string.
if you prefer to use --text option with '\n' in text, you can achieve it by below.
add following line just after the above.
post["text"]=post["text"].replace("\\n","\n")
then, it gets back newline from double escaped to usual single escape.
@ohobby above patch (getting back single escape from double escape) is also included in my PR #6
Hi,
how can i make linebreaks in the text, i post with create_bsky_post.py?
Regards, Oliver