diff --git a/.codespell/wordlist.txt b/.codespell/wordlist.txt index 1ab16276a..986773b60 100644 --- a/.codespell/wordlist.txt +++ b/.codespell/wordlist.txt @@ -15,3 +15,4 @@ tre cancelability ist statics +filetest diff --git a/src/commands.c b/src/commands.c index efc159ad8..92ed72c31 100644 --- a/src/commands.c +++ b/src/commands.c @@ -47,44 +47,62 @@ struct redisCommandArg BITCOUNT_Args[] = { /* BITFIELD tips */ #define BITFIELD_tips NULL -/* BITFIELD encoding_offset argument table */ -struct redisCommandArg BITFIELD_encoding_offset_Subargs[] = { +/* BITFIELD operation encoding_offset argument table */ +struct redisCommandArg BITFIELD_operation_encoding_offset_Subargs[] = { {"encoding",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {"offset",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {0} }; -/* BITFIELD encoding_offset_value argument table */ -struct redisCommandArg BITFIELD_encoding_offset_value_Subargs[] = { -{"encoding",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"offset",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"value",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{0} -}; - -/* BITFIELD encoding_offset_increment argument table */ -struct redisCommandArg BITFIELD_encoding_offset_increment_Subargs[] = { -{"encoding",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"offset",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"increment",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{0} -}; - -/* BITFIELD wrap_sat_fail argument table */ -struct redisCommandArg BITFIELD_wrap_sat_fail_Subargs[] = { +/* BITFIELD operation write wrap_sat_fail argument table */ +struct redisCommandArg BITFIELD_operation_write_wrap_sat_fail_Subargs[] = { {"wrap",ARG_TYPE_PURE_TOKEN,-1,"WRAP",NULL,NULL,CMD_ARG_NONE}, {"sat",ARG_TYPE_PURE_TOKEN,-1,"SAT",NULL,NULL,CMD_ARG_NONE}, {"fail",ARG_TYPE_PURE_TOKEN,-1,"FAIL",NULL,NULL,CMD_ARG_NONE}, {0} }; +/* BITFIELD operation write write_operation encoding_offset_value argument table */ +struct redisCommandArg BITFIELD_operation_write_write_operation_encoding_offset_value_Subargs[] = { +{"encoding",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, +{"offset",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, +{"value",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, +{0} +}; + +/* BITFIELD operation write write_operation encoding_offset_increment argument table */ +struct redisCommandArg BITFIELD_operation_write_write_operation_encoding_offset_increment_Subargs[] = { +{"encoding",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, +{"offset",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, +{"increment",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, +{0} +}; + +/* BITFIELD operation write write_operation argument table */ +struct redisCommandArg BITFIELD_operation_write_write_operation_Subargs[] = { +{"encoding_offset_value",ARG_TYPE_BLOCK,-1,"SET",NULL,NULL,CMD_ARG_NONE,.subargs=BITFIELD_operation_write_write_operation_encoding_offset_value_Subargs}, +{"encoding_offset_increment",ARG_TYPE_BLOCK,-1,"INCRBY",NULL,NULL,CMD_ARG_NONE,.subargs=BITFIELD_operation_write_write_operation_encoding_offset_increment_Subargs}, +{0} +}; + +/* BITFIELD operation write argument table */ +struct redisCommandArg BITFIELD_operation_write_Subargs[] = { +{"wrap_sat_fail",ARG_TYPE_ONEOF,-1,"OVERFLOW",NULL,NULL,CMD_ARG_OPTIONAL,.subargs=BITFIELD_operation_write_wrap_sat_fail_Subargs}, +{"write_operation",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=BITFIELD_operation_write_write_operation_Subargs}, +{0} +}; + +/* BITFIELD operation argument table */ +struct redisCommandArg BITFIELD_operation_Subargs[] = { +{"encoding_offset",ARG_TYPE_BLOCK,-1,"GET",NULL,NULL,CMD_ARG_NONE,.subargs=BITFIELD_operation_encoding_offset_Subargs}, +{"write",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=BITFIELD_operation_write_Subargs}, +{0} +}; + /* BITFIELD argument table */ struct redisCommandArg BITFIELD_Args[] = { {"key",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_NONE}, -{"encoding_offset",ARG_TYPE_BLOCK,-1,"GET",NULL,NULL,CMD_ARG_OPTIONAL,.subargs=BITFIELD_encoding_offset_Subargs}, -{"encoding_offset_value",ARG_TYPE_BLOCK,-1,"SET",NULL,NULL,CMD_ARG_OPTIONAL,.subargs=BITFIELD_encoding_offset_value_Subargs}, -{"encoding_offset_increment",ARG_TYPE_BLOCK,-1,"INCRBY",NULL,NULL,CMD_ARG_OPTIONAL,.subargs=BITFIELD_encoding_offset_increment_Subargs}, -{"wrap_sat_fail",ARG_TYPE_ONEOF,-1,"OVERFLOW",NULL,NULL,CMD_ARG_OPTIONAL,.subargs=BITFIELD_wrap_sat_fail_Subargs}, +{"operation",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE,.subargs=BITFIELD_operation_Subargs}, {0} }; @@ -106,7 +124,7 @@ struct redisCommandArg BITFIELD_RO_encoding_offset_Subargs[] = { /* BITFIELD_RO argument table */ struct redisCommandArg BITFIELD_RO_Args[] = { {"key",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_NONE}, -{"encoding_offset",ARG_TYPE_BLOCK,-1,"GET",NULL,NULL,CMD_ARG_NONE,.subargs=BITFIELD_RO_encoding_offset_Subargs}, +{"encoding_offset",ARG_TYPE_BLOCK,-1,"GET",NULL,NULL,CMD_ARG_MULTIPLE,.subargs=BITFIELD_RO_encoding_offset_Subargs}, {0} }; @@ -1313,13 +1331,20 @@ struct redisCommandArg MIGRATE_key_or_empty_string_Subargs[] = { {0} }; -/* MIGRATE username_password argument table */ -struct redisCommandArg MIGRATE_username_password_Subargs[] = { +/* MIGRATE authentication username_password argument table */ +struct redisCommandArg MIGRATE_authentication_username_password_Subargs[] = { {"username",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {"password",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {0} }; +/* MIGRATE authentication argument table */ +struct redisCommandArg MIGRATE_authentication_Subargs[] = { +{"password",ARG_TYPE_STRING,-1,"AUTH",NULL,"4.0.7",CMD_ARG_OPTIONAL}, +{"username_password",ARG_TYPE_BLOCK,-1,"AUTH2",NULL,"6.0.0",CMD_ARG_OPTIONAL,.subargs=MIGRATE_authentication_username_password_Subargs}, +{0} +}; + /* MIGRATE argument table */ struct redisCommandArg MIGRATE_Args[] = { {"host",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, @@ -1329,8 +1354,7 @@ struct redisCommandArg MIGRATE_Args[] = { {"timeout",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {"copy",ARG_TYPE_PURE_TOKEN,-1,"COPY",NULL,"3.0.0",CMD_ARG_OPTIONAL}, {"replace",ARG_TYPE_PURE_TOKEN,-1,"REPLACE",NULL,"3.0.0",CMD_ARG_OPTIONAL}, -{"password",ARG_TYPE_STRING,-1,"AUTH",NULL,"4.0.7",CMD_ARG_OPTIONAL}, -{"username_password",ARG_TYPE_BLOCK,-1,"AUTH2",NULL,"6.0.0",CMD_ARG_OPTIONAL,.subargs=MIGRATE_username_password_Subargs}, +{"authentication",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=MIGRATE_authentication_Subargs}, {"key",ARG_TYPE_KEY,1,"KEYS",NULL,"3.0.6",CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE}, {0} }; @@ -2089,15 +2113,22 @@ struct redisCommandArg GEORADIUS_RO_Args[] = { /* GEOSEARCH tips */ #define GEOSEARCH_tips NULL -/* GEOSEARCH longitude_latitude argument table */ -struct redisCommandArg GEOSEARCH_longitude_latitude_Subargs[] = { +/* GEOSEARCH from longitude_latitude argument table */ +struct redisCommandArg GEOSEARCH_from_longitude_latitude_Subargs[] = { {"longitude",ARG_TYPE_DOUBLE,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {"latitude",ARG_TYPE_DOUBLE,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {0} }; -/* GEOSEARCH circle unit argument table */ -struct redisCommandArg GEOSEARCH_circle_unit_Subargs[] = { +/* GEOSEARCH from argument table */ +struct redisCommandArg GEOSEARCH_from_Subargs[] = { +{"member",ARG_TYPE_STRING,-1,"FROMMEMBER",NULL,NULL,CMD_ARG_NONE}, +{"longitude_latitude",ARG_TYPE_BLOCK,-1,"FROMLONLAT",NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCH_from_longitude_latitude_Subargs}, +{0} +}; + +/* GEOSEARCH by circle unit argument table */ +struct redisCommandArg GEOSEARCH_by_circle_unit_Subargs[] = { {"m",ARG_TYPE_PURE_TOKEN,-1,"M",NULL,NULL,CMD_ARG_NONE}, {"km",ARG_TYPE_PURE_TOKEN,-1,"KM",NULL,NULL,CMD_ARG_NONE}, {"ft",ARG_TYPE_PURE_TOKEN,-1,"FT",NULL,NULL,CMD_ARG_NONE}, @@ -2105,15 +2136,15 @@ struct redisCommandArg GEOSEARCH_circle_unit_Subargs[] = { {0} }; -/* GEOSEARCH circle argument table */ -struct redisCommandArg GEOSEARCH_circle_Subargs[] = { +/* GEOSEARCH by circle argument table */ +struct redisCommandArg GEOSEARCH_by_circle_Subargs[] = { {"radius",ARG_TYPE_DOUBLE,-1,"BYRADIUS",NULL,NULL,CMD_ARG_NONE}, -{"unit",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCH_circle_unit_Subargs}, +{"unit",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCH_by_circle_unit_Subargs}, {0} }; -/* GEOSEARCH box unit argument table */ -struct redisCommandArg GEOSEARCH_box_unit_Subargs[] = { +/* GEOSEARCH by box unit argument table */ +struct redisCommandArg GEOSEARCH_by_box_unit_Subargs[] = { {"m",ARG_TYPE_PURE_TOKEN,-1,"M",NULL,NULL,CMD_ARG_NONE}, {"km",ARG_TYPE_PURE_TOKEN,-1,"KM",NULL,NULL,CMD_ARG_NONE}, {"ft",ARG_TYPE_PURE_TOKEN,-1,"FT",NULL,NULL,CMD_ARG_NONE}, @@ -2121,11 +2152,18 @@ struct redisCommandArg GEOSEARCH_box_unit_Subargs[] = { {0} }; -/* GEOSEARCH box argument table */ -struct redisCommandArg GEOSEARCH_box_Subargs[] = { +/* GEOSEARCH by box argument table */ +struct redisCommandArg GEOSEARCH_by_box_Subargs[] = { {"width",ARG_TYPE_DOUBLE,-1,"BYBOX",NULL,NULL,CMD_ARG_NONE}, {"height",ARG_TYPE_DOUBLE,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"unit",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCH_box_unit_Subargs}, +{"unit",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCH_by_box_unit_Subargs}, +{0} +}; + +/* GEOSEARCH by argument table */ +struct redisCommandArg GEOSEARCH_by_Subargs[] = { +{"circle",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCH_by_circle_Subargs}, +{"box",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCH_by_box_Subargs}, {0} }; @@ -2146,10 +2184,8 @@ struct redisCommandArg GEOSEARCH_count_Subargs[] = { /* GEOSEARCH argument table */ struct redisCommandArg GEOSEARCH_Args[] = { {"key",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_NONE}, -{"member",ARG_TYPE_STRING,-1,"FROMMEMBER",NULL,NULL,CMD_ARG_OPTIONAL}, -{"longitude_latitude",ARG_TYPE_BLOCK,-1,"FROMLONLAT",NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCH_longitude_latitude_Subargs}, -{"circle",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCH_circle_Subargs}, -{"box",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCH_box_Subargs}, +{"from",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCH_from_Subargs}, +{"by",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCH_by_Subargs}, {"order",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCH_order_Subargs}, {"count",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCH_count_Subargs}, {"withcoord",ARG_TYPE_PURE_TOKEN,-1,"WITHCOORD",NULL,NULL,CMD_ARG_OPTIONAL}, @@ -2166,15 +2202,22 @@ struct redisCommandArg GEOSEARCH_Args[] = { /* GEOSEARCHSTORE tips */ #define GEOSEARCHSTORE_tips NULL -/* GEOSEARCHSTORE longitude_latitude argument table */ -struct redisCommandArg GEOSEARCHSTORE_longitude_latitude_Subargs[] = { +/* GEOSEARCHSTORE from longitude_latitude argument table */ +struct redisCommandArg GEOSEARCHSTORE_from_longitude_latitude_Subargs[] = { {"longitude",ARG_TYPE_DOUBLE,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {"latitude",ARG_TYPE_DOUBLE,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {0} }; -/* GEOSEARCHSTORE circle unit argument table */ -struct redisCommandArg GEOSEARCHSTORE_circle_unit_Subargs[] = { +/* GEOSEARCHSTORE from argument table */ +struct redisCommandArg GEOSEARCHSTORE_from_Subargs[] = { +{"member",ARG_TYPE_STRING,-1,"FROMMEMBER",NULL,NULL,CMD_ARG_NONE}, +{"longitude_latitude",ARG_TYPE_BLOCK,-1,"FROMLONLAT",NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCHSTORE_from_longitude_latitude_Subargs}, +{0} +}; + +/* GEOSEARCHSTORE by circle unit argument table */ +struct redisCommandArg GEOSEARCHSTORE_by_circle_unit_Subargs[] = { {"m",ARG_TYPE_PURE_TOKEN,-1,"M",NULL,NULL,CMD_ARG_NONE}, {"km",ARG_TYPE_PURE_TOKEN,-1,"KM",NULL,NULL,CMD_ARG_NONE}, {"ft",ARG_TYPE_PURE_TOKEN,-1,"FT",NULL,NULL,CMD_ARG_NONE}, @@ -2182,15 +2225,15 @@ struct redisCommandArg GEOSEARCHSTORE_circle_unit_Subargs[] = { {0} }; -/* GEOSEARCHSTORE circle argument table */ -struct redisCommandArg GEOSEARCHSTORE_circle_Subargs[] = { +/* GEOSEARCHSTORE by circle argument table */ +struct redisCommandArg GEOSEARCHSTORE_by_circle_Subargs[] = { {"radius",ARG_TYPE_DOUBLE,-1,"BYRADIUS",NULL,NULL,CMD_ARG_NONE}, -{"unit",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCHSTORE_circle_unit_Subargs}, +{"unit",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCHSTORE_by_circle_unit_Subargs}, {0} }; -/* GEOSEARCHSTORE box unit argument table */ -struct redisCommandArg GEOSEARCHSTORE_box_unit_Subargs[] = { +/* GEOSEARCHSTORE by box unit argument table */ +struct redisCommandArg GEOSEARCHSTORE_by_box_unit_Subargs[] = { {"m",ARG_TYPE_PURE_TOKEN,-1,"M",NULL,NULL,CMD_ARG_NONE}, {"km",ARG_TYPE_PURE_TOKEN,-1,"KM",NULL,NULL,CMD_ARG_NONE}, {"ft",ARG_TYPE_PURE_TOKEN,-1,"FT",NULL,NULL,CMD_ARG_NONE}, @@ -2198,11 +2241,18 @@ struct redisCommandArg GEOSEARCHSTORE_box_unit_Subargs[] = { {0} }; -/* GEOSEARCHSTORE box argument table */ -struct redisCommandArg GEOSEARCHSTORE_box_Subargs[] = { +/* GEOSEARCHSTORE by box argument table */ +struct redisCommandArg GEOSEARCHSTORE_by_box_Subargs[] = { {"width",ARG_TYPE_DOUBLE,-1,"BYBOX",NULL,NULL,CMD_ARG_NONE}, {"height",ARG_TYPE_DOUBLE,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"unit",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCHSTORE_box_unit_Subargs}, +{"unit",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCHSTORE_by_box_unit_Subargs}, +{0} +}; + +/* GEOSEARCHSTORE by argument table */ +struct redisCommandArg GEOSEARCHSTORE_by_Subargs[] = { +{"circle",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCHSTORE_by_circle_Subargs}, +{"box",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCHSTORE_by_box_Subargs}, {0} }; @@ -2224,10 +2274,8 @@ struct redisCommandArg GEOSEARCHSTORE_count_Subargs[] = { struct redisCommandArg GEOSEARCHSTORE_Args[] = { {"destination",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_NONE}, {"source",ARG_TYPE_KEY,1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"member",ARG_TYPE_STRING,-1,"FROMMEMBER",NULL,NULL,CMD_ARG_OPTIONAL}, -{"longitude_latitude",ARG_TYPE_BLOCK,-1,"FROMLONLAT",NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCHSTORE_longitude_latitude_Subargs}, -{"circle",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCHSTORE_circle_Subargs}, -{"box",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCHSTORE_box_Subargs}, +{"from",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCHSTORE_from_Subargs}, +{"by",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=GEOSEARCHSTORE_by_Subargs}, {"order",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCHSTORE_order_Subargs}, {"count",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=GEOSEARCHSTORE_count_Subargs}, {"storedist",ARG_TYPE_PURE_TOKEN,-1,"STOREDIST",NULL,NULL,CMD_ARG_OPTIONAL}, @@ -4790,7 +4838,7 @@ struct redisCommandArg MODULE_LOADEX_args_Subargs[] = { /* MODULE LOADEX argument table */ struct redisCommandArg MODULE_LOADEX_Args[] = { {"path",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"configs",ARG_TYPE_BLOCK,-1,"CONFIG",NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE,.subargs=MODULE_LOADEX_configs_Subargs}, +{"configs",ARG_TYPE_BLOCK,-1,"CONFIG",NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE|CMD_ARG_MULTIPLE_TOKEN,.subargs=MODULE_LOADEX_configs_Subargs}, {"args",ARG_TYPE_BLOCK,-1,"ARGS",NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE,.subargs=MODULE_LOADEX_args_Subargs}, {0} }; @@ -6919,6 +6967,13 @@ commandHistory SET_History[] = { /* SET tips */ #define SET_tips NULL +/* SET condition argument table */ +struct redisCommandArg SET_condition_Subargs[] = { +{"nx",ARG_TYPE_PURE_TOKEN,-1,"NX",NULL,NULL,CMD_ARG_NONE}, +{"xx",ARG_TYPE_PURE_TOKEN,-1,"XX",NULL,NULL,CMD_ARG_NONE}, +{0} +}; + /* SET expiration argument table */ struct redisCommandArg SET_expiration_Subargs[] = { {"seconds",ARG_TYPE_INTEGER,-1,"EX",NULL,"2.6.12",CMD_ARG_NONE}, @@ -6929,20 +6984,13 @@ struct redisCommandArg SET_expiration_Subargs[] = { {0} }; -/* SET condition argument table */ -struct redisCommandArg SET_condition_Subargs[] = { -{"nx",ARG_TYPE_PURE_TOKEN,-1,"NX",NULL,NULL,CMD_ARG_NONE}, -{"xx",ARG_TYPE_PURE_TOKEN,-1,"XX",NULL,NULL,CMD_ARG_NONE}, -{0} -}; - /* SET argument table */ struct redisCommandArg SET_Args[] = { {"key",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_NONE}, {"value",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"expiration",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=SET_expiration_Subargs}, {"condition",ARG_TYPE_ONEOF,-1,NULL,NULL,"2.6.12",CMD_ARG_OPTIONAL,.subargs=SET_condition_Subargs}, {"get",ARG_TYPE_PURE_TOKEN,-1,"GET",NULL,"6.2.0",CMD_ARG_OPTIONAL}, +{"expiration",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.subargs=SET_expiration_Subargs}, {0} }; diff --git a/src/commands/bitfield.json b/src/commands/bitfield.json index 1f667ce05..5c6fc6105 100644 --- a/src/commands/bitfield.json +++ b/src/commands/bitfield.json @@ -44,84 +44,100 @@ "key_spec_index": 0 }, { - "token": "GET", - "name": "encoding_offset", - "type": "block", - "optional": true, - "arguments": [ - { - "name": "encoding", - "type": "string" - }, - { - "name": "offset", - "type": "integer" - } - ] - }, - { - "token": "SET", - "name": "encoding_offset_value", - "type": "block", - "optional": true, - "arguments": [ - { - "name": "encoding", - "type": "string" - }, - { - "name": "offset", - "type": "integer" - }, - { - "name": "value", - "type": "integer" - } - ] - }, - { - "token": "INCRBY", - "name": "encoding_offset_increment", - "type": "block", - "optional": true, - "arguments": [ - { - "name": "encoding", - "type": "string" - }, - { - "name": "offset", - "type": "integer" - }, - { - "name": "increment", - "type": "integer" - } - ] - }, - { - "token": "OVERFLOW", - "name": "wrap_sat_fail", + "name": "operation", "type": "oneof", - "optional": true, + "multiple": "true", "arguments": [ { - "name": "wrap", - "type": "pure-token", - "token": "WRAP" + "token": "GET", + "name": "encoding_offset", + "type": "block", + "arguments": [ + { + "name": "encoding", + "type": "string" + }, + { + "name": "offset", + "type": "integer" + } + ] }, { - "name": "sat", - "type": "pure-token", - "token": "SAT" - }, - { - "name": "fail", - "type": "pure-token", - "token": "FAIL" + "name": "write", + "type": "block", + "arguments": [ + { + "token": "OVERFLOW", + "name": "wrap_sat_fail", + "type": "oneof", + "optional": true, + "arguments": [ + { + "name": "wrap", + "type": "pure-token", + "token": "WRAP" + }, + { + "name": "sat", + "type": "pure-token", + "token": "SAT" + }, + { + "name": "fail", + "type": "pure-token", + "token": "FAIL" + } + ] + }, + { + "name": "write_operation", + "type": "oneof", + "arguments": [ + { + "token": "SET", + "name": "encoding_offset_value", + "type": "block", + "arguments": [ + { + "name": "encoding", + "type": "string" + }, + { + "name": "offset", + "type": "integer" + }, + { + "name": "value", + "type": "integer" + } + ] + }, + { + "token": "INCRBY", + "name": "encoding_offset_increment", + "type": "block", + "arguments": [ + { + "name": "encoding", + "type": "string" + }, + { + "name": "offset", + "type": "integer" + }, + { + "name": "increment", + "type": "integer" + } + ] + } + ] + } + ] } ] } ] } -} +} \ No newline at end of file diff --git a/src/commands/bitfield_ro.json b/src/commands/bitfield_ro.json index a8ec85c29..951fde0f5 100644 --- a/src/commands/bitfield_ro.json +++ b/src/commands/bitfield_ro.json @@ -43,6 +43,7 @@ "token": "GET", "name": "encoding_offset", "type": "block", + "multiple": "true", "arguments": [ { "name": "encoding", diff --git a/src/commands/geosearch.json b/src/commands/geosearch.json index 9730d214e..a83dcaadb 100644 --- a/src/commands/geosearch.json +++ b/src/commands/geosearch.json @@ -39,102 +39,110 @@ "key_spec_index": 0 }, { - "token": "FROMMEMBER", - "name": "member", - "type": "string", - "optional": true - }, - { - "token": "FROMLONLAT", - "name": "longitude_latitude", - "type": "block", - "optional": true, + "name": "from", + "type": "oneof", "arguments": [ { - "name": "longitude", - "type": "double" + "token": "FROMMEMBER", + "name": "member", + "type": "string" }, { - "name": "latitude", - "type": "double" - } - ] - }, - { - "name": "circle", - "type": "block", - "optional": true, - "arguments": [ - { - "token": "BYRADIUS", - "name": "radius", - "type": "double" - }, - { - "name": "unit", - "type": "oneof", + "token": "FROMLONLAT", + "name": "longitude_latitude", + "type": "block", "arguments": [ { - "name": "m", - "type": "pure-token", - "token": "m" + "name": "longitude", + "type": "double" }, { - "name": "km", - "type": "pure-token", - "token": "km" - }, - { - "name": "ft", - "type": "pure-token", - "token": "ft" - }, - { - "name": "mi", - "type": "pure-token", - "token": "mi" + "name": "latitude", + "type": "double" } ] } ] }, { - "name": "box", - "type": "block", - "optional": true, + "name": "by", + "type": "oneof", "arguments": [ { - "token": "BYBOX", - "name": "width", - "type": "double" - }, - { - "name": "height", - "type": "double" - }, - { - "name": "unit", - "type": "oneof", + "name": "circle", + "type": "block", "arguments": [ { - "name": "m", - "type": "pure-token", - "token": "m" + "token": "BYRADIUS", + "name": "radius", + "type": "double" }, { - "name": "km", - "type": "pure-token", - "token": "km" + "name": "unit", + "type": "oneof", + "arguments": [ + { + "name": "m", + "type": "pure-token", + "token": "m" + }, + { + "name": "km", + "type": "pure-token", + "token": "km" + }, + { + "name": "ft", + "type": "pure-token", + "token": "ft" + }, + { + "name": "mi", + "type": "pure-token", + "token": "mi" + } + ] + } + ] + }, + { + "name": "box", + "type": "block", + "arguments": [ + { + "token": "BYBOX", + "name": "width", + "type": "double" }, { - "name": "ft", - "type": "pure-token", - "token": "ft" + "name": "height", + "type": "double" }, { - "name": "mi", - "type": "pure-token", - "token": "mi" + "name": "unit", + "type": "oneof", + "arguments": [ + { + "name": "m", + "type": "pure-token", + "token": "m" + }, + { + "name": "km", + "type": "pure-token", + "token": "km" + }, + { + "name": "ft", + "type": "pure-token", + "token": "ft" + }, + { + "name": "mi", + "type": "pure-token", + "token": "mi" + } + ] } ] } @@ -195,4 +203,4 @@ } ] } -} +} \ No newline at end of file diff --git a/src/commands/geosearchstore.json b/src/commands/geosearchstore.json index a44ebfe86..16db5d37e 100644 --- a/src/commands/geosearchstore.json +++ b/src/commands/geosearchstore.json @@ -63,102 +63,110 @@ "key_spec_index": 1 }, { - "token": "FROMMEMBER", - "name": "member", - "type": "string", - "optional": true - }, - { - "token": "FROMLONLAT", - "name": "longitude_latitude", - "type": "block", - "optional": true, + "name": "from", + "type": "oneof", "arguments": [ { - "name": "longitude", - "type": "double" + "token": "FROMMEMBER", + "name": "member", + "type": "string" }, { - "name": "latitude", - "type": "double" - } - ] - }, - { - "name": "circle", - "type": "block", - "optional": true, - "arguments": [ - { - "token": "BYRADIUS", - "name": "radius", - "type": "double" - }, - { - "name": "unit", - "type": "oneof", + "token": "FROMLONLAT", + "name": "longitude_latitude", + "type": "block", "arguments": [ { - "name": "m", - "type": "pure-token", - "token": "m" + "name": "longitude", + "type": "double" }, { - "name": "km", - "type": "pure-token", - "token": "km" - }, - { - "name": "ft", - "type": "pure-token", - "token": "ft" - }, - { - "name": "mi", - "type": "pure-token", - "token": "mi" + "name": "latitude", + "type": "double" } ] } ] }, { - "name": "box", - "type": "block", - "optional": true, + "name": "by", + "type": "oneof", "arguments": [ { - "token": "BYBOX", - "name": "width", - "type": "double" - }, - { - "name": "height", - "type": "double" - }, - { - "name": "unit", - "type": "oneof", + "name": "circle", + "type": "block", "arguments": [ { - "name": "m", - "type": "pure-token", - "token": "m" + "token": "BYRADIUS", + "name": "radius", + "type": "double" }, { - "name": "km", - "type": "pure-token", - "token": "km" + "name": "unit", + "type": "oneof", + "arguments": [ + { + "name": "m", + "type": "pure-token", + "token": "m" + }, + { + "name": "km", + "type": "pure-token", + "token": "km" + }, + { + "name": "ft", + "type": "pure-token", + "token": "ft" + }, + { + "name": "mi", + "type": "pure-token", + "token": "mi" + } + ] + } + ] + }, + { + "name": "box", + "type": "block", + "arguments": [ + { + "token": "BYBOX", + "name": "width", + "type": "double" }, { - "name": "ft", - "type": "pure-token", - "token": "ft" + "name": "height", + "type": "double" }, { - "name": "mi", - "type": "pure-token", - "token": "mi" + "name": "unit", + "type": "oneof", + "arguments": [ + { + "name": "m", + "type": "pure-token", + "token": "m" + }, + { + "name": "km", + "type": "pure-token", + "token": "km" + }, + { + "name": "ft", + "type": "pure-token", + "token": "ft" + }, + { + "name": "mi", + "type": "pure-token", + "token": "mi" + } + ] } ] } @@ -207,4 +215,4 @@ } ] } -} +} \ No newline at end of file diff --git a/src/commands/migrate.json b/src/commands/migrate.json index d07fe4b15..b9a52aa69 100644 --- a/src/commands/migrate.json +++ b/src/commands/migrate.json @@ -125,27 +125,33 @@ "since": "3.0.0" }, { - "token": "AUTH", - "name": "password", - "type": "string", + "name": "authentication", + "type": "oneof", "optional": true, - "since": "4.0.7" - - }, - { - "token": "AUTH2", - "name": "username_password", - "type": "block", - "optional": true, - "since": "6.0.0", "arguments": [ { - "name": "username", - "type": "string" + "token": "AUTH", + "name": "password", + "type": "string", + "optional": true, + "since": "4.0.7" }, { - "name": "password", - "type": "string" + "token": "AUTH2", + "name": "username_password", + "type": "block", + "optional": true, + "since": "6.0.0", + "arguments": [ + { + "name": "username", + "type": "string" + }, + { + "name": "password", + "type": "string" + } + ] } ] }, @@ -160,4 +166,4 @@ } ] } -} +} \ No newline at end of file diff --git a/src/commands/module-loadex.json b/src/commands/module-loadex.json index e772cbfe4..97e8f2b58 100644 --- a/src/commands/module-loadex.json +++ b/src/commands/module-loadex.json @@ -23,6 +23,7 @@ "token": "CONFIG", "type": "block", "multiple": true, + "multiple_token": true, "optional": true, "arguments": [ { diff --git a/src/commands/set.json b/src/commands/set.json index 267ab311a..688d534d7 100644 --- a/src/commands/set.json +++ b/src/commands/set.json @@ -65,6 +65,31 @@ "name": "value", "type": "string" }, + { + "name": "condition", + "type": "oneof", + "optional": true, + "since": "2.6.12", + "arguments": [ + { + "name": "nx", + "type": "pure-token", + "token": "NX" + }, + { + "name": "xx", + "type": "pure-token", + "token": "XX" + } + ] + }, + { + "name": "get", + "token": "GET", + "type": "pure-token", + "optional": true, + "since": "6.2.0" + }, { "name": "expiration", "type": "oneof", @@ -101,31 +126,6 @@ "since": "6.0.0" } ] - }, - { - "name": "condition", - "type": "oneof", - "optional": true, - "since": "2.6.12", - "arguments": [ - { - "name": "nx", - "type": "pure-token", - "token": "NX" - }, - { - "name": "xx", - "type": "pure-token", - "token": "XX" - } - ] - }, - { - "name": "get", - "token": "GET", - "type": "pure-token", - "optional": true, - "since": "6.2.0" } ] } diff --git a/src/help.h b/src/help.h index e25ca3fa3..dfecf5981 100644 --- a/src/help.h +++ b/src/help.h @@ -1,4 +1,4 @@ -/* Automatically generated by utils/generate-command-help.rb, do not edit. */ +/* Automatically generated by ./generate-command-help.rb, do not edit. */ #ifndef __REDIS_HELP_H #define __REDIS_HELP_H @@ -130,12 +130,12 @@ struct commandHelp { 15, "2.6.0" }, { "BITFIELD", - "key [GET encoding offset] [SET encoding offset value] [INCRBY encoding offset increment] [OVERFLOW WRAP|SAT|FAIL]", + "key GET encoding offset|[OVERFLOW WRAP|SAT|FAIL] SET encoding offset value|INCRBY encoding offset increment [GET encoding offset|[OVERFLOW WRAP|SAT|FAIL] SET encoding offset value|INCRBY encoding offset increment ...]", "Perform arbitrary bitfield integer operations on strings", 15, "3.2.0" }, { "BITFIELD_RO", - "key GET encoding offset", + "key GET encoding offset [encoding offset ...]", "Perform arbitrary bitfield integer operations on strings. Read-only variant of BITFIELD", 15, "6.2.0" }, @@ -690,12 +690,12 @@ struct commandHelp { 13, "3.2.10" }, { "GEOSEARCH", - "key [FROMMEMBER member] [FROMLONLAT longitude latitude] [BYRADIUS radius M|KM|FT|MI] [BYBOX width height M|KM|FT|MI] [ASC|DESC] [COUNT count [ANY]] [WITHCOORD] [WITHDIST] [WITHHASH]", + "key FROMMEMBER member|FROMLONLAT longitude latitude BYRADIUS radius M|KM|FT|MI|BYBOX width height M|KM|FT|MI [ASC|DESC] [COUNT count [ANY]] [WITHCOORD] [WITHDIST] [WITHHASH]", "Query a sorted set representing a geospatial index to fetch members inside an area of a box or a circle.", 13, "6.2.0" }, { "GEOSEARCHSTORE", - "destination source [FROMMEMBER member] [FROMLONLAT longitude latitude] [BYRADIUS radius M|KM|FT|MI] [BYBOX width height M|KM|FT|MI] [ASC|DESC] [COUNT count [ANY]] [STOREDIST]", + "destination source FROMMEMBER member|FROMLONLAT longitude latitude BYRADIUS radius M|KM|FT|MI|BYBOX width height M|KM|FT|MI [ASC|DESC] [COUNT count [ANY]] [STOREDIST]", "Query a sorted set representing a geospatial index to fetch members inside an area of a box or a circle, and store the result in another key.", 13, "6.2.0" }, @@ -1000,7 +1000,7 @@ struct commandHelp { 1, "1.0.0" }, { "MIGRATE", - "host port key| destination-db timeout [COPY] [REPLACE] [AUTH password] [AUTH2 username password] [KEYS key [key ...]]", + "host port key| destination-db timeout [COPY] [REPLACE] [[AUTH password]|[AUTH2 username password]] [KEYS key [key ...]]", "Atomically transfer a key from a Redis instance to another one.", 0, "2.6.0" }, @@ -1355,7 +1355,7 @@ struct commandHelp { 8, "1.0.0" }, { "SET", - "key value [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL] [NX|XX] [GET]", + "key value [NX|XX] [GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]", "Set the string value of a key", 1, "1.0.0" }, diff --git a/utils/generate-command-help.rb b/utils/generate-command-help.rb index 482a3b9f8..3ef00b3b5 100755 --- a/utils/generate-command-help.rb +++ b/utils/generate-command-help.rb @@ -1,4 +1,9 @@ -#!/usr/bin/env ruby +#!/usr/bin/env ruby -w +# Usage: generate-command-help.r [path/to/commands.json] +# or: generate-commands-json.py | generate-command-help.rb - +# +# Defaults to downloading commands.json from the redis-doc repo if not provided +# or STDINed. GROUPS = [ "generic", @@ -66,16 +71,27 @@ def commands require "net/https" require "json" require "uri" - - url = URI.parse "https://raw.githubusercontent.com/redis/redis-doc/master/commands.json" - client = Net::HTTP.new url.host, url.port - client.use_ssl = true - response = client.get url.path - if response.is_a?(Net::HTTPSuccess) - @commands = JSON.parse(response.body) + if ARGV.length > 0 + if ARGV[0] == '-' + data = STDIN.read + elsif FileTest.exist? ARGV[0] + data = File.read(ARGV[0]) + else + raise Exception.new "File not found: #{ARGV[0]}" + end else - response.error! + url = URI.parse "https://raw.githubusercontent.com/redis/redis-doc/master/commands.json" + client = Net::HTTP.new url.host, url.port + client.use_ssl = true + response = client.get url.path + if !response.is_a?(Net::HTTPSuccess) + response.error! + return + else + data = response.body + end end + @commands = JSON.parse(data) end def generate_groups