RxSwift icon indicating copy to clipboard operation
RxSwift copied to clipboard

Update cURL command for easier copy-pasting

Open EliaCereda opened this issue 1 year ago • 4 comments
trafficstars

Print a backslash at the end of each line in the cURL command printed by URLSession requests, so that the command can be directly copy-pasted in the Terminal

EliaCereda avatar Nov 10 '24 11:11 EliaCereda

Great addition! However, it doesn't handle the optional body correctly. Also, you might consider switching to using #"..."# syntax to make things a bit less confusing.

danielt1263 avatar Nov 10 '24 12:11 danielt1263

It’s not clear to me what you mean exactly. Multi-line bodies work out of the box for me, since the body is inside quotes and those newlines don’t break the command.

Let me know if there is a specific case that is broken for you

EliaCereda avatar Nov 10 '24 20:11 EliaCereda

The fix looks good. If you don't mind I would switch to use # delimiters so you can do less escaping with slashes and juse use \n. Maintaining / debugging this will be painful later on :)

Let me know your thoughts 💪

freak4pc avatar Nov 10 '24 20:11 freak4pc

Yes, I understand your point, it's a good point. I don't have my computer on hand to test this right now, if you want just go ahead and make the change yourself ;)

EliaCereda avatar Nov 10 '24 21:11 EliaCereda