perhaps this exists already, but I've tried all the standard comment symbols and searched the docs/issues extensively
redis-cli doesn't seem to support (i.e. ignore) the concept of lines that are comments
for example, I have a handful of tests that require pre-populating the redis server. this is handled though txt files that are fed into redis-cli. i'd love to be able to have comments in them. What i mean is using inline docs/comments, similar to the following
-- this test uses database 8
select 8
// prep the "a2b|{uid}" datastore
eval "for i=1,10000 do\n redis.call('hset', 'a2b|' .. i, 70, 1)\n end\nreturn 1" 0
# prep the "b2a|{cid}" datastore
eval "for i=1,1000 do\n redis.call('hset', 'b2a|' .. i, 70, 1)\n end\nreturn 1" 0
Comment From: itamarhaber
There's a module for that: https://github.com/picotera/commentDis
Seriously though - are comments in redis-cli "scripts" that important?
Comment From: jvanasco
Thanks! I'll install that.
Our scripts to populate test data for edge cases range from 40-60 lines each, and are pretty complex so require in-line documentation. The core tests are only 4-5 lines. For all our tests, it's preferential to load them into an instance using redis-cli and not a client, because our apps use (and integrated tests run in) multiple languages.
Right now we're writing comments inline and using a pre-processer to strip them out.
Comment From: itamarhaber
I'd stick w/ the preprocesspr fwiw
Comment From: Art-B
Seriously though - are comments in redis-cli "scripts" that important?
As some one generating scripts from scraping other data sources (eg Excel files) they are very helpful.
My current workaround is
SET comment "these have been converted to millemetres from whatever units they were in"
Other uses are to embed time stamps of generation what triggered the event etc. There are multiple uses.
Comment From: KeesCBakker
One could use a LUA comment like:
eval "-- single line comment " 0
Comment From: ramwin
Useful feature request. Many sql file support comment like
/* this is a comment */
Now I use echo <comment> to add comment.