Closed james2doyle closed 8 years ago
Actually, I have a question already. What category in the commands/README do I add the help for this?
I like the section Package Management
, but Tim may have a different opinion.
Oh man! I was trying to find a better way but didn't think of the string format template. It's a no brainer now. I'll switch to the string format.
I'll get to this ASAP On Sun, Aug 30, 2015 at 1:01 PM Ryan Phillips notifications@github.com wrote:
I like the section Package Management, but Tim may have a different opinion.
— Reply to this email directly or view it on GitHub https://github.com/luvit/lit/pull/126#issuecomment-136178915.
On Aug 30, 2015 3:01 PM, "Ryan Phillips" notifications@github.com wrote:
I like the section Package Management, but Tim may have a different opinion.
Yep, sounds great.
— Reply to this email directly or view it on GitHub.
My only suggestion is to leave the quotes out of the template and write a simple quoting function to make it a little more robust. Though, we don't need to support all input strings I guess, soo maybe that's less needed here. On Aug 30, 2015 3:56 PM, "James Doyle" notifications@github.com wrote:
Oh man! I was trying to find a better way but didn't think of the string format template. It's a no brainer now. I'll switch to the string format.
I'll get to this ASAP On Sun, Aug 30, 2015 at 1:01 PM Ryan Phillips notifications@github.com wrote:
I like the section Package Management, but Tim may have a different opinion.
— Reply to this email directly or view it on GitHub https://github.com/luvit/lit/pull/126#issuecomment-136178915.
— Reply to this email directly or view it on GitHub https://github.com/luvit/lit/pull/126#issuecomment-136189989.
Ok @creationix I think by using the %q
format over %s
will fix the quoting issue. This is a simple test:
And here is the description from the Lua.org docs:
To quote an arbitrary string in a secure way, the format function, from the standard string library, offers the option "%q". It surrounds the string with double quotes and properly escapes double quotes, newlines, and some other characters inside the string.
I didn't realize that the %q
option existed. No wonder I couldn't find any good Lua string escape functions, they aren't really needed for quotes and string literals.
It doesn't escape $
or backticks, is that a problem here?
Wow, that's great, I never knew about %q
. That should work perfectly.
I pulled the latest lit and merge it into this branch so it's good to go
Lovely work!
Very cool. :+1:
This is in the fresh lit v2.2.13 version. lit update
!
I think I have got this down now. I'll explain some features:
This is my first PR that is Lua based, so let me know what needs to be fixed or changed before going ahead.